home *** CD-ROM | disk | FTP | other *** search
/ Floppyshop 2 / Floppyshop - 2.zip / Floppyshop - 2.iso / art&graf.ix / art-0074 / qrt / qrt_doc.txt < prev    next >
Text File  |  1997-04-16  |  103KB  |  3,367 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.         
  8.                              Introduction to the QRT
  9.                                    Ray Tracer
  10.         
  11.         
  12.         QRT is a ray tracing  image  rendering  system  that runs under a
  13.         variety  of  operating  systems.   It  has  a  free  format input
  14.         language   with   extensive   error   detection   and   reporting
  15.         capabilities.
  16.         
  17.         This manual is divided into several sections as follows:
  18.         
  19.            QRT Language Reference:
  20.            
  21.                This is  a  quick  reference  guide  to  the  QRT  command
  22.                language.  It can suffice as a tutorial for those familiar
  23.                with ray tracing programs,  or  function as a guide to QRT
  24.                features not described in the User Manual.
  25.                
  26.            QRT User Manual:
  27.            
  28.                The User Manual is a  more  complete  tutorial  to the QRT
  29.                system.  It describes the  basic  commands and features of
  30.                QRT, without listing every possible command or option.  It
  31.                would be a good starting  place  for  beginners.  QRT bugs
  32.                and desired  enhancements  are  listed  at the end of this
  33.                section.
  34.                
  35.            QRT Sample Programs
  36.            
  37.                These are actual QRT input files;  they show suggested QRT
  38.                indenting style and give examples of various features.
  39.  
  40.            Machine Specifics
  41.            
  42.                The QRT post processor is machine dependent.  This section
  43.                contains instructions on using  it, as well as information
  44.                on other machine dependent features.
  45.  
  46.  
  47.  
  48.  
  49.  
  50.  
  51.  
  52.  
  53.  
  54.  
  55.  
  56.  
  57.  
  58.  
  59.  
  60.         QRT Ray Tracer               Page 1                  Introduction
  61.  
  62.  
  63.  
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70.  
  71.  
  72.  
  73.                
  74.  
  75.  
  76.  
  77.  
  78.  
  79.                
  80.         
  81.         
  82.         
  83.         
  84.         
  85.         References
  86.            
  87.            
  88.            
  89.            Howard Anton, Elementary Linear Algebra, Anton Textbooks,
  90.               Inc.,   1987
  91.            
  92.            
  93.            David F. Rogers, Procedural Elements for Computer Graphics,
  94.               McGraw Hill, Inc., 1985
  95.            
  96.            
  97.            Eric Graham, Graphic Scene Simulations, Amiga World,  CW
  98.               Communications/Peterborough, Inc., May/June 1987
  99.            
  100.            
  101.  
  102.  
  103.  
  104.  
  105.  
  106.  
  107.  
  108.  
  109.  
  110.  
  111.  
  112.  
  113.  
  114.  
  115.  
  116.  
  117.  
  118.  
  119.  
  120.  
  121.  
  122.  
  123.  
  124.  
  125.  
  126.         QRT Ray Tracer               Page 2                  Introduction
  127.  
  128.  
  129.  
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136.  
  137.  
  138.  
  139.                                  Table of Contents
  140.            
  141.                                                                Page
  142.            
  143.                 I. QRT Language Reference Manual
  144.            
  145.                    A. Introduction  ..........................   1
  146.                    B. Setup Commands .........................   3
  147.            
  148.                       1. Sky .................................   3
  149.                       2. Ground ..............................   3
  150.                       3. Focal Length ........................   4
  151.                       4. First Scan ..........................   4
  152.                       5. Last Scan ...........................   5
  153.                       6. File Name ...........................   5
  154.                       7. Observer ............................   6
  155.                       8. Lamp ................................   7
  156.            
  157.                    C. Primitive Types ........................   8
  158.            
  159.                       1. Sphere ..............................   8
  160.                       2. Parallelogram .......................   9
  161.                       3. Triangle ............................  10
  162.                       4. Ring ................................  11
  163.                       5. Quadratic ...........................  12
  164.            
  165.                    D. Patterned Surfaces .....................  14
  166.            
  167.                       1. Pattern .............................  14
  168.                       2. Rectangle ...........................  16
  169.                       3. Circle ..............................  17
  170.            
  171.                    E. Bounding Boxes .........................  18
  172.            
  173.                       1. Begin Bbox ..........................  18
  174.                       2. End Bbox ............................  18
  175.            
  176.                    F. Instances ..............................  19
  177.            
  178.                       1. Begin Instances .....................  19
  179.                       2. End Instances .......................  20
  180.                       3. Instance Of .........................  21
  181.            
  182.                    G. Setting Defaults .......................  22
  183.            
  184.                       1. Default .............................  22
  185.                
  186.  
  187.  
  188.  
  189.  
  190.  
  191.  
  192.         QRT Ray Tracer               Page 3                  Introduction
  193.  
  194.  
  195.  
  196.  
  197.  
  198.  
  199.  
  200.  
  201.  
  202.  
  203.  
  204.  
  205.            
  206.                              Table of Contents - Cont.
  207.            
  208.                                                                Page
  209.            
  210.                 II. QRT Users Manual
  211.            
  212.                    A. Introduction  ..........................   1
  213.                    B. Comparison to Other Systems ............   1
  214.                    C. The World ..............................   2
  215.                    D. Input Language .........................   3
  216.                    E. Illumination Model .....................   4
  217.                    F. Light Sources ..........................   6
  218.                    G. Observer ...............................   7
  219.                    H. Filenames ..............................   8
  220.                    I. Sky and Ground .........................   8
  221.                    J. Bounding Boxes .........................   9
  222.                    K. Patterns ...............................  10
  223.                    L. Instances ..............................  12
  224.                    M. Defaults ...............................  13
  225.                    N. Problems, Bugs .........................  14
  226.                    O. Possible Enhancements ..................  14
  227.            
  228.            
  229.  
  230.  
  231.  
  232.  
  233.  
  234.  
  235.  
  236.  
  237.  
  238.  
  239.  
  240.  
  241.  
  242.  
  243.  
  244.  
  245.  
  246.  
  247.  
  248.  
  249.  
  250.  
  251.  
  252.  
  253.  
  254.  
  255.  
  256.  
  257.  
  258.         QRT Ray Tracer               Page 4                  Introduction
  259.  
  260.  
  261.  
  262.  
  263.  
  264.  
  265.  
  266.  
  267.  
  268.  
  269.  
  270.  
  271.         
  272.         
  273.         
  274.                              QRT Language Reference
  275.         
  276.         
  277.         INTRODUCTION
  278.         
  279.         This document is a reference  guide  to the QRT command language.
  280.         One section is devoted to each  QRT  command.   All parameters to
  281.         commands are listed.
  282.         
  283.         More information on QRT can  be  found  in  the User's Manual and
  284.         Technical Reference Manual.
  285.         
  286.         
  287.         The following table lists syntax used in this document:
  288.         
  289.             TEXT       MEANING              EXAMPLE             RANGE
  290.         
  291.             (x,y,z)    floating pt vector   (10, -20, 30.56)    all
  292.         
  293.             (r,g,b)    color value triple   (0, .5, 1.00)       0 to 1
  294.         
  295.             i          an integer           12                  0 to 127
  296.         
  297.             n          floating pt number   -123.4              all
  298.         
  299.             p          positive float       123.4               >0
  300.         
  301.             string     text string          FOO_BAR             ASCII
  302.         
  303.         
  304.         Each  section  of  this  document  contains  one  or  more of the
  305.         following sub-sections:
  306.         
  307.  
  308.  
  309.  
  310.  
  311.  
  312.  
  313.  
  314.  
  315.  
  316.  
  317.  
  318.  
  319.  
  320.  
  321.  
  322.  
  323.  
  324.         QRT Ray Tracer               Page 1            Language Reference
  325.  
  326.  
  327.  
  328.  
  329.  
  330.  
  331.  
  332.  
  333.  
  334.  
  335.  
  336.  
  337.         
  338.           Command Type          :  OPTIONAL or REQUIRED
  339.         
  340.           Parameters (required) :  Lists required parameters
  341.           Parameters (optional) :  Lists optional parameters
  342.         
  343.           Optional Forms        :  Alternatives for parameter names. Ex:
  344.                                    'horiz' = 'horizon' means either can
  345.                                    be used as a parameter name.
  346.         
  347.           Example               :  An example of the command (with all
  348.                                    required parameters, but not
  349.                                    necessarily all optional ones.
  350.         
  351.           Restrictions          :  Things not to do
  352.         
  353.           See also              :  Similar commands
  354.         
  355.         
  356.         QRT has a free format input language, and parameters can be given
  357.         in any order.
  358.         
  359.         
  360.         
  361.  
  362.  
  363.  
  364.  
  365.  
  366.  
  367.  
  368.  
  369.  
  370.  
  371.  
  372.  
  373.  
  374.  
  375.  
  376.  
  377.  
  378.  
  379.  
  380.  
  381.  
  382.  
  383.  
  384.  
  385.  
  386.  
  387.  
  388.  
  389.  
  390.         QRT Ray Tracer               Page 2            Language Reference
  391.  
  392.  
  393.  
  394.  
  395.  
  396.  
  397.  
  398.  
  399.  
  400.  
  401.  
  402.  
  403.         
  404.                             QRT Misc. Setup Commands
  405.         
  406.         
  407.         SKY:
  408.            
  409.            Command type: OPTIONAL
  410.            
  411.            The SKY command is used to specify  the color of all rays that
  412.            don't hit any other object.  The sky is black by default.  The
  413.            sky color at the zenith (up),  and  horizon  can be specified,
  414.            and QRT will  blend  the  colors  in  between  as  smoothly as
  415.            possible.  In addition, dithering can be specified.
  416.            
  417.            Parameters (optional):
  418.            
  419.                zenith = (r,g,b)        : the color of the zenith
  420.                horiz  = (r,g,b)        : the color at the horizon
  421.                dither = i              : dithering
  422.            
  423.            Optional forms:
  424.            
  425.                'horiz' = 'horizon'
  426.            
  427.            Example:
  428.            
  429.                SKY (  horiz  = (0, 0, .6),
  430.                       zenith = (0, 0, .4),
  431.                       dither = 5
  432.                    )
  433.            
  434.            See also : GROUND
  435.            
  436.            
  437.         GROUND:
  438.         
  439.            Command type: OPTIONAL
  440.            
  441.            QRT does not have a specific  ground  command.  Instead, use a
  442.            large parallelogram with an optional pattern.
  443.            
  444.                PARALLELOGRAM (  loc = (-10000, 0, -10000),
  445.                                  v1  = ( 20000, 0,      0),
  446.                                  v2  = ( 0,     0,  20000),
  447.            
  448.                                  pattern = PATTERN_OF_CHOICE
  449.                               )
  450.            
  451.            See also : PARALLELOGRAM
  452.            
  453.  
  454.  
  455.  
  456.         QRT Ray Tracer               Page 3            Language Reference
  457.  
  458.  
  459.  
  460.  
  461.  
  462.  
  463.  
  464.  
  465.  
  466.  
  467.  
  468.  
  469.         FOC_LENGTH:
  470.            
  471.            Command type: OPTIONAL
  472.            
  473.            This sets the focal length of QRT's  "camera".  The default is
  474.            50, but it can be  changed  with  this  command.  As with 35mm
  475.            photography, larger numbers  result  in  a 'telephoto' effect,
  476.            and smaller numbers will result  in wide angle (and distorted)
  477.            views.
  478.            
  479.            Example:
  480.            
  481.                FOC_LENGTH = 70
  482.            
  483.            Restrictions:
  484.            
  485.                0 < FOC_LENGTH
  486.            
  487.            
  488.         FIRST_SCAN:
  489.            
  490.            Command type: OPTIONAL
  491.            
  492.            By default, QRT generates an image with the same resolution as
  493.            your screen.   However,  it  can  be  instructed  to  create a
  494.            partial image  by  using  this  command  and  LAST_SCAN.  This
  495.            feature may  not  be  supported,  depending  on  your QRT post
  496.            processor.  First scan should be less than the Y resolution of
  497.            your screen.
  498.            
  499.            Example:
  500.            
  501.                FIRST_SCAN = 100
  502.            
  503.            Restrictions:
  504.            
  505.                0 < FIRST_SCAN < y-resolution
  506.            
  507.            See also : LAST_SCAN
  508.            
  509.            
  510.  
  511.  
  512.  
  513.  
  514.  
  515.  
  516.  
  517.  
  518.  
  519.  
  520.  
  521.  
  522.         QRT Ray Tracer               Page 4            Language Reference
  523.  
  524.  
  525.  
  526.  
  527.  
  528.  
  529.  
  530.  
  531.  
  532.  
  533.  
  534.  
  535.            
  536.         LAST_SCAN:
  537.            
  538.            Command type: OPTIONAL
  539.            
  540.            This command is similar  to  FIRST_SCAN.  LAST_SCAN  should be
  541.            less than the Y resolution of your screen.
  542.            
  543.            Example:
  544.            
  545.                LAST_SCAN = 300
  546.            
  547.            Restrictions:
  548.            
  549.                0 < LAST_SCAN < y-resolution
  550.            
  551.            See also : FIRST_SCAN
  552.            
  553.            
  554.         FILE_NAME:
  555.            
  556.            Command type: REQUIRED
  557.            
  558.            This is used to set  the  output  file  for QRT, which will be
  559.            read by the post processor.  The  file  name will be mapped to
  560.            upper case.   Some  restrictions  may   arise from file naming
  561.            conventions on specific computers.
  562.            
  563.                Example:
  564.            
  565.                    FILE_NAME = QRT_IMAGE.RAW
  566.            
  567.            
  568.  
  569.  
  570.  
  571.  
  572.  
  573.  
  574.  
  575.  
  576.  
  577.  
  578.  
  579.  
  580.  
  581.  
  582.  
  583.  
  584.  
  585.  
  586.  
  587.  
  588.         QRT Ray Tracer               Page 5            Language Reference
  589.  
  590.  
  591.  
  592.  
  593.  
  594.  
  595.  
  596.  
  597.  
  598.  
  599.  
  600.  
  601.            
  602.         OBSERVER:
  603.            
  604.            Command type: REQUIRED
  605.            
  606.            OBSERVER tells QRT where  the  observer  is  located,  and his
  607.            direction of view.  The view direction  is specified by giving
  608.            the coordinates he should look at.   In addition, the observer
  609.            UP vector may be given.  This is, by default, (0,1,0).
  610.            
  611.            Parameters (required):
  612.            
  613.                loc     = (x,y,z)           : location of observer
  614.                lookat  = (x,y,z)           : point of interest
  615.            
  616.            Parameters (optional):
  617.            
  618.                up      = (x,y,z)           : up vector
  619.            
  620.            Optional forms:
  621.            
  622.                'loc' = 'pos' = 'location' = 'position'
  623.            
  624.            Example:
  625.            
  626.                OBSERVER ( loc    = (0, 0, 0),
  627.                           lookat = (100, 0, 0)
  628.                         )
  629.            
  630.            Restrictions:
  631.            
  632.                The observer cannot  look  in  the  direction  of  the  up
  633.            vector.
  634.                'lookat' cannot be equal to 'loc'.
  635.                'up' must have non-zero length.
  636.            
  637.            
  638.  
  639.  
  640.  
  641.  
  642.  
  643.  
  644.  
  645.  
  646.  
  647.  
  648.  
  649.  
  650.  
  651.  
  652.  
  653.  
  654.         QRT Ray Tracer               Page 6            Language Reference
  655.  
  656.  
  657.  
  658.  
  659.  
  660.  
  661.  
  662.  
  663.  
  664.  
  665.  
  666.  
  667.            
  668.         LAMP:
  669.            
  670.            Command type: OPTIONAL
  671.            
  672.            Lamps are  sources  of  light  in  QRT.   They  can  be placed
  673.            anywhere, and emit any  color  and  intensity  of  light.  The
  674.            ambient light value is the  color  of  the lamp.  The distance
  675.            parameter is the minimum  distance  from the lamp that objects
  676.            will be illuminated at full intensity.  Most objects should be
  677.            farther from the lamp than  this  value,  or else they will be
  678.            washed out.  The radius parameter  is ignored by this  version
  679.            of QRT, but may  eventually  be  used  to  implement penumbral
  680.            shadows.
  681.            
  682.            Parameters (required):
  683.            
  684.                loc     = (x,y,z)           : location of object
  685.                dist    = p                 : distance of max illumination
  686.            
  687.            Parameters (optional):
  688.            
  689.                amb     = (r,g,b)           : ambient light
  690.                radius  = p                 : radius
  691.            
  692.            
  693.            Optional forms:
  694.            
  695.                'loc' = 'pos' = 'location' = 'position'
  696.            
  697.            Example:
  698.            
  699.                LAMP (     loc    = (12,34,56),
  700.                           radius = 123.4,
  701.                     )
  702.            
  703.            
  704.  
  705.  
  706.  
  707.  
  708.  
  709.  
  710.  
  711.  
  712.  
  713.  
  714.  
  715.  
  716.  
  717.  
  718.  
  719.  
  720.         QRT Ray Tracer               Page 7            Language Reference
  721.  
  722.  
  723.  
  724.  
  725.  
  726.  
  727.  
  728.  
  729.  
  730.  
  731.  
  732.  
  733.            
  734.                                QRT Primitive Types
  735.         
  736.         
  737.         SPHERE:
  738.            
  739.            Command type: OPTIONAL
  740.            
  741.            SPHERE creates a sphere  with  a  given  location, radius, and
  742.            surface characteristics.
  743.            
  744.            Parameters (required):
  745.            
  746.                loc     = (x,y,z)           : location of object
  747.                radius  = p                 : radius
  748.            
  749.            Parameters (optional):
  750.            
  751.                name    = string            : name for object
  752.                pattern = string            : pattern name to attach
  753.                amb     = (r,g,b)           : ambient light
  754.                diff    = (r,g,b)           : diffuse reflection
  755.                trans   = (r,g,b)           : transmission
  756.                mirror  = (r,g,b)           : mirror reflection
  757.                fuzz    = i                 : currently unused
  758.                index   = p                 : index of refraction
  759.                dither  = i                 : dithering
  760.                sreflect= p                 : Phong specular refl. coeff.
  761.                reflect = p                 : percent specular reflection
  762.            
  763.            Optional forms:
  764.            
  765.                'loc' = 'pos' = 'location' = 'position'
  766.            
  767.            Example:
  768.            
  769.                SPHERE   ( loc    = (100, 100, 50.234),
  770.                           radius = 123.4,
  771.                           diff   = (1.00, .20, .20)
  772.                         )
  773.            
  774.            
  775.  
  776.  
  777.  
  778.  
  779.  
  780.  
  781.  
  782.  
  783.  
  784.  
  785.  
  786.         QRT Ray Tracer               Page 8            Language Reference
  787.  
  788.  
  789.  
  790.  
  791.  
  792.  
  793.  
  794.  
  795.  
  796.  
  797.  
  798.  
  799.            
  800.         PARALLELOGRAM:
  801.            
  802.            Command type: OPTIONAL
  803.            
  804.            This command creates a  parallelogram  with  a given location,
  805.            shape, and surface  characteristics.   Two  vectors define the
  806.            shape of the parallelogram (they need not be orthogonal).
  807.            
  808.            Parameters (required):
  809.            
  810.                loc     = (x,y,z)           : location of object
  811.                v1      = (x,y,z)           : vector for side one
  812.                v2      = (x,y,z)           : vector for side two
  813.            
  814.            Parameters (optional):
  815.            
  816.                name    = string            : name for object
  817.                pattern = string            : pattern name to attach
  818.                amb     = (r,g,b)           : ambient light
  819.                diff    = (r,g,b)           : diffuse reflection
  820.                trans   = (r,g,b)           : transmission
  821.                mirror  = (r,g,b)           : mirror reflection
  822.                fuzz    = i                 : currently unused
  823.                index   = p                 : index of refraction
  824.                dither  = i                 : dithering
  825.                sreflect= p                 : Phong specular refl. coeff.
  826.                reflect = p                 : percent specular reflection
  827.            
  828.            Optional forms:
  829.            
  830.                'loc' = 'pos' = 'location' = 'position'
  831.                'vect1' = 'v1'
  832.                'vect2' = 'v2'
  833.            
  834.            Example:
  835.            
  836.                PARALLELOGRAM ( loc    = (10, 20, 50),
  837.                                vect1  = (20,  0,  0),
  838.                                vect2  = ( 0,  0,  50),
  839.                                diff   = (0, .90, .20)
  840.                              )
  841.            
  842.            
  843.  
  844.  
  845.  
  846.  
  847.  
  848.  
  849.  
  850.  
  851.  
  852.         QRT Ray Tracer               Page 9            Language Reference
  853.  
  854.  
  855.  
  856.  
  857.  
  858.  
  859.  
  860.  
  861.  
  862.  
  863.  
  864.  
  865.            
  866.         TRIANGLE:
  867.            
  868.            Command type: OPTIONAL
  869.            
  870.            The TRIANGLE  command  (similar  to  PARALLELOGRAM)  creates a
  871.            triangle shape.  Two vectors define the sides of the triangle.
  872.            
  873.            Parameters (required):
  874.            
  875.                loc     = (x,y,z)           : location of object
  876.                v1      = (x,y,z)           : vector for side one
  877.                v2      = (x,y,z)           : vector for side two
  878.            
  879.            Parameters (optional):
  880.            
  881.                name    = string            : name for object
  882.                pattern = string            : pattern name to attach
  883.                amb     = (r,g,b)           : ambient light
  884.                diff    = (r,g,b)           : diffuse reflection
  885.                trans   = (r,g,b)           : transmission
  886.                mirror  = (r,g,b)           : mirror reflection
  887.                fuzz    = i                 : currently unused
  888.                index   = p                 : index of refraction
  889.                dither  = i                 : dithering
  890.                sreflect= p                 : Phong specular refl. coeff.
  891.                reflect = p                 : percent specular reflection
  892.            
  893.            
  894.            Optional forms:
  895.            
  896.                'loc' = 'pos' = 'location' = 'position'
  897.                'vect1' = 'v1'
  898.                'vect2' = 'v2'
  899.            
  900.            Example:
  901.            
  902.                TRIANGLE      ( loc    = (52, 21, 50),
  903.                                vect1  = (10,  5,  0),
  904.                                vect2  = ( 0,  8, 20),
  905.                                diff   = ( 0,  0,  0),
  906.                                mirror = ( 1,  1,  1)
  907.                              );
  908.            
  909.            
  910.  
  911.  
  912.  
  913.  
  914.  
  915.  
  916.  
  917.  
  918.         QRT Ray Tracer               Page 10           Language Reference
  919.  
  920.  
  921.  
  922.  
  923.  
  924.  
  925.  
  926.  
  927.  
  928.  
  929.  
  930.  
  931.            
  932.         RING:
  933.         
  934.         Command type: OPTIONAL
  935.         
  936.         RING creates a ring (annulus), which  is a circle with a  smaller
  937.         circle cut out of it.  If  the  innder  radius  is zero, the ring
  938.         will be a simple circle.  Two  vectors   define  the plane of the
  939.         annulus, as with RING and PARALLELOGRAM.
  940.         
  941.         Parameters (required):
  942.         
  943.             loc     = (x,y,z)           : location of object
  944.             v1      = (x,y,z)           : vector one
  945.             v2      = (x,y,z)           : vector two
  946.             rad_1   = p                 : inner radius
  947.             rad_2   = p                 : outer radius
  948.         
  949.         Parameters (optional):
  950.         
  951.             name    = string            : name for object
  952.             pattern = string            : pattern name to attach
  953.             amb     = (r,g,b)           : ambient light
  954.             diff    = (r,g,b)           : diffuse reflection
  955.             trans   = (r,g,b)           : transmission
  956.             mirror  = (r,g,b)           : mirror reflection
  957.             fuzz    = i                 : currently unused
  958.             index   = p                 : index of refraction
  959.             dither  = i                 : dithering
  960.             sreflect= p                 : Phong specular refl. coeff.
  961.             reflect = p                 : percent specular reflection
  962.         
  963.         Optional forms:
  964.         
  965.             'loc' = 'pos' = 'location' = 'position'
  966.             'vect1' = 'v1'
  967.             'vect2' = 'v2'
  968.         
  969.         Example:
  970.         
  971.             RING      ( loc    = (52, 21, 50),
  972.                         v1     = (10,  5,  0),
  973.                         v2     = ( 0,  8, 20),
  974.                         rad_1  = 10,
  975.                         rad_2  = 20,
  976.                       )
  977.         
  978.         Restrictions:
  979.         
  980.             0 < rad_1 < rad_2
  981.  
  982.  
  983.  
  984.         QRT Ray Tracer               Page 11           Language Reference
  985.  
  986.  
  987.  
  988.  
  989.  
  990.  
  991.  
  992.  
  993.  
  994.  
  995.  
  996.  
  997.         
  998.         QUADRATIC:
  999.            
  1000.            Command type: OPTIONAL
  1001.            
  1002.            This  command  creates  a  quadratic   surface  given  by  the
  1003.            equation:
  1004.            
  1005.                     2     2     2
  1006.                  a x + b y + c z  = d
  1007.            
  1008.            The coefficients a,b,c and d can be specified.  This primitive
  1009.            can be used to  create  cylinders,  cones,  oblong  spheroids,
  1010.            etc.  Several min  and  max  parameters  specify  the  maximum
  1011.            extents of the surface.
  1012.            
  1013.            Parameters (required):
  1014.            
  1015.                loc     = (x,y,z)           : location of object
  1016.                a       = n
  1017.                b       = n
  1018.                c       = n
  1019.                d       = n
  1020.                xmax    = n
  1021.                xmin    = n
  1022.                ymax    = n
  1023.                ymin    = n
  1024.                zmax    = n
  1025.                zmin    = n
  1026.            
  1027.            Parameters (optional):
  1028.            
  1029.                name    = string            : name for object
  1030.                pattern = string            : pattern name to attach
  1031.                amb     = (r,g,b)           : ambient light
  1032.                diff    = (r,g,b)           : diffuse reflection
  1033.                trans   = (r,g,b)           : transmission
  1034.                mirror  = (r,g,b)           : mirror reflection
  1035.                fuzz    = i                 : currently unused
  1036.                index   = p                 : index of refraction
  1037.                dither  = i                 : dithering
  1038.                sreflect= p                 : Phong specular refl. coeff.
  1039.                reflect = p                 : percent specular reflection
  1040.            
  1041.            
  1042.            Optional forms:
  1043.            
  1044.                'loc' = 'pos' = 'location' = 'position'
  1045.            
  1046.  
  1047.  
  1048.  
  1049.  
  1050.         QRT Ray Tracer               Page 12           Language Reference
  1051.  
  1052.  
  1053.  
  1054.  
  1055.  
  1056.  
  1057.  
  1058.  
  1059.  
  1060.  
  1061.  
  1062.  
  1063.            
  1064.            Example:
  1065.            
  1066.                { ** vertical cylinder ** }
  1067.            
  1068.                QUADRATIC   ( loc    = (57, 21.2, 0),
  1069.                                a    = 1,
  1070.                                b    = 0,
  1071.                                c    = 1,
  1072.                                d    = 100
  1073.                            );
  1074.            
  1075.            Restrictions:
  1076.            
  1077.                a != 0 or b != 0 or c != 0
  1078.            
  1079.            
  1080.  
  1081.  
  1082.  
  1083.  
  1084.  
  1085.  
  1086.  
  1087.  
  1088.  
  1089.  
  1090.  
  1091.  
  1092.  
  1093.  
  1094.  
  1095.  
  1096.  
  1097.  
  1098.  
  1099.  
  1100.  
  1101.  
  1102.  
  1103.  
  1104.  
  1105.  
  1106.  
  1107.  
  1108.  
  1109.  
  1110.  
  1111.  
  1112.  
  1113.  
  1114.  
  1115.  
  1116.         QRT Ray Tracer               Page 13           Language Reference
  1117.  
  1118.  
  1119.  
  1120.  
  1121.  
  1122.  
  1123.  
  1124.  
  1125.  
  1126.  
  1127.  
  1128.  
  1129.            
  1130.            
  1131.                                Patterned Surfaces
  1132.         
  1133.         
  1134.         PATTERN:
  1135.            
  1136.            Command type: OPTIONAL
  1137.            
  1138.            This  command  creates  a  pattern  definition  which  can  be
  1139.            attached  to  any  primitive  object.   A  pattern  is  a  two
  1140.            dimensional array than can  be  mapped  to  the surface of any
  1141.            primitive.  Patterns must be defined before they are used. The
  1142.            PATTERN keyword serves  two  functions:  to  create  a pattern
  1143.            definition, and to attach this definition  to a primitive. The
  1144.            correct meaning is found by  context:   if the PATTERN keyword
  1145.            appears in a primitive  definition  followed  by a name, it is
  1146.            assumed to refer to a predefined  pattern. However, if PATTERN
  1147.            occurs outside any primitive definition, it is assumed to be a
  1148.            pattern  definition.   If  all  the  pattern  definitions  are
  1149.            grouped at the top of the  file,  they  will always be defined
  1150.            before they are used.
  1151.             
  1152.            A pattern is defined by giving  it  a size, a name, and one or
  1153.            more sub-pattern definitions.   There  are currently two types
  1154.            of sub-patterns: CIRCLE and  RECTANGLE.   The sub-pattern list
  1155.            can be of any length  (although  long  lists will slow the ray
  1156.            tracer), and can  use  several  of  each  type  of sub-pattern
  1157.            primitive.
  1158.            
  1159.            The X and Y size parameters  specify  the size of the pattern;
  1160.            the pattern will be  repeated  over  the  surface of an object
  1161.            each X or Y units in  the  indicated  direction.   These  size
  1162.            units are arbitrary, since the pattern can be given a new size
  1163.            when attached to an object.
  1164.            
  1165.            In each sub-pattern, any object surface characteristics can be
  1166.            specified.  If a given ray hits  this sub-pattern, the surface
  1167.            will be colored  as  indicated.   If  it  does not hit any sub
  1168.            pattern   in   the   list,   the   objects   default   surface
  1169.            characteristics will be  used.    The  example below defines a
  1170.            red-checkered pattern.  The background  color of the object to
  1171.            which this pattern is attached will determine the color of the
  1172.            other checker box in the pattern.
  1173.            
  1174.            Parameters (required):
  1175.            
  1176.                name    = string            : name for pattern
  1177.                x_size  = p                 : x size of pattern
  1178.                y_size  = p                 : y size of pattern
  1179.            
  1180.  
  1181.  
  1182.         QRT Ray Tracer               Page 14           Language Reference
  1183.  
  1184.  
  1185.  
  1186.  
  1187.  
  1188.  
  1189.  
  1190.  
  1191.  
  1192.  
  1193.  
  1194.  
  1195.            Parameters (optional):
  1196.            
  1197.                CIRCLE  = circle_defn       : CIRCLE sub-pattern - see
  1198.                                              reference for CIRCLE
  1199.            
  1200.                RECTANGLE = rect_defn       : RECTANGLE sub-pattern - see
  1201.                                              reference for RECTANGLE
  1202.            
  1203.            Optional forms:
  1204.            
  1205.                'loc' = 'pos' = 'location' = 'position'
  1206.            
  1207.            Example:
  1208.            
  1209.                 PATTERN ( x_size = 16,
  1210.                           y_size = 16,
  1211.                           name   = CHECK,
  1212.            
  1213.                           RECTANGLE (
  1214.                             start_x = 0, start_y = 0,
  1215.                             end_x   = 8, end_y   = 8,
  1216.                             diff    = (1.00, .20, .20);
  1217.                           )
  1218.            
  1219.                           RECTANGLE (
  1220.                             start_x = 8,  start_y = 8,
  1221.                             end_x   = 16, end_y   = 16,
  1222.                             diff    = (1.00, .20, .20);
  1223.                           )
  1224.                         )
  1225.            
  1226.                This pattern can now be attached to an object as follows:
  1227.            
  1228.                SPHERE ( { ** sphere definition here ** }
  1229.                         pattern = CHECK,
  1230.                         xmult   = .5,
  1231.                         ymult   = .5
  1232.                       )
  1233.            
  1234.                Where the xmult and ymult parameters specify a new size
  1235.                for the pattern.
  1236.            
  1237.            Restrictions:
  1238.            
  1239.                At least one sub-pattern must appear.
  1240.            
  1241.                If two sub-patterns overlap in a region, the last one
  1242.                   defined will be used in this region.
  1243.            
  1244.            See also : RECTANGLE, CIRCLE
  1245.  
  1246.  
  1247.  
  1248.         QRT Ray Tracer               Page 15           Language Reference
  1249.  
  1250.  
  1251.  
  1252.  
  1253.  
  1254.  
  1255.  
  1256.  
  1257.  
  1258.  
  1259.  
  1260.  
  1261.            
  1262.         RECTANGLE:
  1263.            
  1264.            Command type: OPTIONAL
  1265.            
  1266.            RECTANGLE is a type of sub-pattern.
  1267.            
  1268.            Parameters (required):
  1269.            
  1270.                start_x = p                 : start position for rectangle
  1271.                start_y = p
  1272.                end_x   = p                 : end position for rectangle
  1273.                end_y   = p
  1274.            
  1275.            Parameters (optional):
  1276.            
  1277.                amb     = (r,g,b)           : ambient light
  1278.                diff    = (r,g,b)           : diffuse reflection
  1279.                trans   = (r,g,b)           : transmission
  1280.                mirror  = (r,g,b)           : mirror reflection
  1281.                fuzz    = i                 : currently unused
  1282.                index   = p                 : index of refraction
  1283.                dither  = i                 : dithering
  1284.                sreflect= p                 : Phong specular refl. coeff.
  1285.                reflect = p                 : percent specular reflection
  1286.            
  1287.            Example:
  1288.            
  1289.                RECTANGLE (
  1290.                    start_x = 10, start_y = 12,
  1291.                    end_x   = 15, end_y   = 15,
  1292.            
  1293.                    diff    = (1.00, .20, .20);
  1294.                )
  1295.            
  1296.            Restrictions:
  1297.            
  1298.                RECTANGLE should be used only within a pattern definition.
  1299.                start_x < end_x
  1300.                start_y < end_y
  1301.            
  1302.            See also : PATTERN
  1303.            
  1304.  
  1305.  
  1306.  
  1307.  
  1308.  
  1309.  
  1310.  
  1311.  
  1312.  
  1313.  
  1314.         QRT Ray Tracer               Page 16           Language Reference
  1315.  
  1316.  
  1317.  
  1318.  
  1319.  
  1320.  
  1321.  
  1322.  
  1323.  
  1324.  
  1325.  
  1326.  
  1327.            
  1328.         CIRCLE:
  1329.            
  1330.            Command type: OPTIONAL
  1331.            
  1332.            CIRCLE is a type of sub-pattern.
  1333.            
  1334.            Parameters (required):
  1335.            
  1336.                radius  = p                 : radius
  1337.            
  1338.            Parameters (optional):
  1339.            
  1340.                amb     = (r,g,b)           : ambient light
  1341.                diff    = (r,g,b)           : diffuse reflection
  1342.                trans   = (r,g,b)           : transmission
  1343.                mirror  = (r,g,b)           : mirror reflection
  1344.                fuzz    = i                 : currently unused
  1345.                index   = p                 : index of refraction
  1346.                dither  = i                 : dithering
  1347.                sreflect= p                 : Phong specular refl. coeff.
  1348.                reflect = p                 : percent specular reflection
  1349.            
  1350.            Example:
  1351.            
  1352.                CIRCLE (
  1353.                  radius  = 5,
  1354.                  diff    = (1.00, .20, .20);
  1355.                )
  1356.            
  1357.            Restrictions:
  1358.            
  1359.                CIRCLE should be used only within a pattern definition.
  1360.            
  1361.            
  1362.            See also : PATTERN
  1363.            
  1364.  
  1365.  
  1366.  
  1367.  
  1368.  
  1369.  
  1370.  
  1371.  
  1372.  
  1373.  
  1374.  
  1375.  
  1376.  
  1377.  
  1378.  
  1379.  
  1380.         QRT Ray Tracer               Page 17           Language Reference
  1381.  
  1382.  
  1383.  
  1384.  
  1385.  
  1386.  
  1387.  
  1388.  
  1389.  
  1390.  
  1391.  
  1392.  
  1393.            
  1394.                                  Bounding Boxes
  1395.         
  1396.         
  1397.         BEGIN_BBOX:
  1398.            
  1399.            Command type: OPTIONAL
  1400.            
  1401.            The BEGIN_BBOX, END_BBOX  commands  form an enclosing bounding
  1402.            box around  a  group  of  objects  (which  may  include  other
  1403.            bounding boxes).  An optional  name  must precede the bounding
  1404.            box begin statement.  Bounding  boxes  cannot be given surface
  1405.            characteristics, since they are conceptual objects.
  1406.            
  1407.            Parameters (optional):
  1408.            
  1409.                name    = string            : name for box
  1410.            
  1411.            Example:
  1412.            
  1413.                name = SAMPLE_BBOX
  1414.                BEGIN_BBOX
  1415.                    SPHERE   ();            { ** sphere    here ** }
  1416.                    TRIANGLE ();            { ** triangle  here ** }
  1417.                END_BBOX
  1418.            
  1419.            Restrictions:
  1420.            
  1421.                Must be paired with an END_BBOX statement.
  1422.            
  1423.            
  1424.         END_BBOX:
  1425.            
  1426.            Command type: OPTIONAL
  1427.            
  1428.            Companion command to BEGIN_BBOX.
  1429.            
  1430.            Example:
  1431.            
  1432.                name = SAMPLE_BBOX
  1433.                BEGIN_BBOX
  1434.                    SPHERE   ();            { ** sphere    here ** }
  1435.                    TRIANGLE ();            { ** triangle  here ** }
  1436.                END_BBOX
  1437.            
  1438.            Restrictions:
  1439.            
  1440.                Must be paired with a BEGIN_BBOX statement.
  1441.            
  1442.            
  1443.  
  1444.  
  1445.  
  1446.         QRT Ray Tracer               Page 18           Language Reference
  1447.  
  1448.  
  1449.  
  1450.  
  1451.  
  1452.  
  1453.  
  1454.  
  1455.  
  1456.  
  1457.  
  1458.  
  1459.            
  1460.         
  1461.                                     Instances
  1462.         
  1463.         
  1464.         
  1465.         BEGIN_INSTANCES:
  1466.            
  1467.            Command type: OPTIONAL
  1468.            
  1469.            Several primitives may be grouped into an 'instance', and this
  1470.            group can easily be placed in several locations.  In addition,
  1471.            it can be resized.  All  instance  definitions  must be placed
  1472.            within the BEGIN_INSTANCES and END_INSTANCES  statements; only
  1473.            one set of these statements  is  allowed.   A group of objects
  1474.            must be placed in a BBOX, and this  BBOX must be given a name.
  1475.            In the following example, three objects are defined: OBJECT_1,
  1476.            SUB_OBJECT_1, and  OBJECT_2.  Any  inclusion  of OBJECT_1 will
  1477.            implicitly  include   SUB_OBJECT_1,  but  not  OBJECT_2.   Any
  1478.            arbitrary object tree can  be  included.  Referring  to a node
  1479.            will include the sub-tree rooted at that node.
  1480.            
  1481.            Example:
  1482.            
  1483.                BEGIN_INSTANCES
  1484.            
  1485.                    NAME = OBJECT_1
  1486.                    BEGIN_BBOX
  1487.            
  1488.                        { ** some primitives here ** }
  1489.                        NAME = SUB_OBJECT_1
  1490.                        BEGIN_BBOX
  1491.                          { ** some more primitives here ** }
  1492.                        END_BBOX
  1493.                    END_BBOX
  1494.            
  1495.                    NAME = OBJECT_2
  1496.                    BEGIN_BBOX
  1497.                        { ** more primitives ** }
  1498.                    END_BBOX
  1499.            
  1500.                END_INSTANCES
  1501.            
  1502.            Restrictions:
  1503.            
  1504.                There can be only one BEGIN_INSTANCES statement.
  1505.            
  1506.            See also: END_INSTANCES, INSTANCE_OF
  1507.            
  1508.            
  1509.  
  1510.  
  1511.  
  1512.         QRT Ray Tracer               Page 19           Language Reference
  1513.  
  1514.  
  1515.  
  1516.  
  1517.  
  1518.  
  1519.  
  1520.  
  1521.  
  1522.  
  1523.  
  1524.  
  1525.            
  1526.         END_INSTANCES:
  1527.            
  1528.            Command type : OPTIONAL
  1529.            
  1530.            This command specifies  the  end  of  the  instance tree.  Any
  1531.            primitive  after  the  END_INSTANCES  statement  are  actually
  1532.            displayed as part of the image.
  1533.            
  1534.            Restrictions:
  1535.            
  1536.                There can be only one END_INSTANCES statement.
  1537.            
  1538.                See also: BEGIN_INSTANCES, INSTANCE_OF
  1539.            
  1540.            
  1541.  
  1542.  
  1543.  
  1544.  
  1545.  
  1546.  
  1547.  
  1548.  
  1549.  
  1550.  
  1551.  
  1552.  
  1553.  
  1554.  
  1555.  
  1556.  
  1557.  
  1558.  
  1559.  
  1560.  
  1561.  
  1562.  
  1563.  
  1564.  
  1565.  
  1566.  
  1567.  
  1568.  
  1569.  
  1570.  
  1571.  
  1572.  
  1573.  
  1574.  
  1575.  
  1576.  
  1577.  
  1578.         QRT Ray Tracer               Page 20           Language Reference
  1579.  
  1580.  
  1581.  
  1582.  
  1583.  
  1584.  
  1585.  
  1586.  
  1587.  
  1588.  
  1589.  
  1590.  
  1591.            
  1592.         INSTANCE_OF:
  1593.            
  1594.            Command type: OPTIONAL
  1595.            
  1596.            After an instance tree is  defined  with  the BEGIN_INSTANCES,
  1597.            END_INSTANCES command pair, parts  of the tree can be referred
  1598.            to with the  INSTANCE_OF  statement.   This  actually puts the
  1599.            sub-tree in the image.  You must specify the name of the  root
  1600.            of the sub-tree.   The  original  instance  should  be defined
  1601.            relative to (0,0,0),  and  the  location  parameter  specifies
  1602.            where the new copy will go.
  1603.            
  1604.            Parameters (required):
  1605.            
  1606.                name    = string            : name of sub-tree
  1607.                loc     = (x,y,z)           : location for instance
  1608.            
  1609.            Parameters (optional):
  1610.            
  1611.                scale   = (x,y,z)           : scale factor
  1612.            
  1613.            Example:
  1614.            
  1615.                INSTANCE_OF ( name   = OBJECT_1,
  1616.                              loc    = (100.23, 20.23, 45.678),
  1617.                              scale  = (.5, .5, .5)
  1618.                            )
  1619.            
  1620.            Optional forms:
  1621.            
  1622.                'loc' = 'pos' = 'location' = 'position'
  1623.            
  1624.            Restrictions:
  1625.            
  1626.                All scale factor entries should be greater than zero.
  1627.            
  1628.                If the scale factor entries are unequal, some primitives
  1629.                  in the instance will not be affected correctly.  For
  1630.                  example, a SPHERE will remain round if scaled by
  1631.                  (1,2,3), not change to a QUADRATIC spheroid.
  1632.            
  1633.            
  1634.            See also : BEGIN_INSTANCES, END_INSTANCES
  1635.            
  1636.            
  1637.         
  1638.         
  1639.  
  1640.  
  1641.  
  1642.  
  1643.  
  1644.         QRT Ray Tracer               Page 21           Language Reference
  1645.  
  1646.  
  1647.  
  1648.  
  1649.  
  1650.  
  1651.  
  1652.  
  1653.  
  1654.  
  1655.  
  1656.  
  1657.         
  1658.                                 Setting Defaults
  1659.         
  1660.         DEFAULT:
  1661.            
  1662.            Command type: OPTIONAL
  1663.            
  1664.            QRT sets  certain  defaults  for  the  color  attributes  of a
  1665.            surrface.   The   standard   default   is  for  a  white,  non
  1666.            reflective, non shiny, non  transparent  surface with a medium
  1667.            amount of dithering.  These  defaults  can be changed with the
  1668.            DEFAULT  command.   More  than  one  DEFAULT  command  can  be
  1669.            included, in which case each one  affects all primitives after
  1670.            it and before the  next  DEFAULT  or  the end of the file.  In
  1671.            addition to new surface characteristics, the NO_SHADOW keyword
  1672.            instructs QRT not to compute shadow information for the scene.
  1673.            This can decrease  image  generation  time  at  the expense of
  1674.            image quality.
  1675.            
  1676.            Parameters (optional):
  1677.            
  1678.                no_shadow                   : QRT will not compute
  1679.                                              shadow information
  1680.            
  1681.                amb       = (r,g,b)         : ambient light
  1682.                diff      = (r,g,b)         : diffuse reflection
  1683.                trans     = (r,g,b)         : transmission
  1684.                mirror    = (r,g,b)         : mirror reflection
  1685.                fuzz      = i               : currently unused
  1686.                index     = p               : index of refraction
  1687.                dither    = i               : dithering
  1688.                sreflect  = p               : Phong specular refl. coeff.
  1689.                reflect   = p               : percent specular reflection
  1690.            
  1691.            Example:
  1692.            
  1693.                DEFAULT ( no_shadow,         { ** no shadowing ** }
  1694.                          diff = (1, 0, 0)   { ** default = red objects **
  1695.            }
  1696.                        )
  1697.            
  1698.  
  1699.  
  1700.  
  1701.  
  1702.  
  1703.  
  1704.  
  1705.  
  1706.  
  1707.  
  1708.  
  1709.  
  1710.         QRT Ray Tracer               Page 22           Language Reference
  1711.  
  1712.  
  1713.  
  1714.  
  1715.  
  1716.  
  1717.  
  1718.  
  1719.  
  1720.  
  1721.  
  1722.  
  1723.  
  1724.         
  1725.                                 QRT Users Manual
  1726.         
  1727.         
  1728.         INTRODUCTION
  1729.         
  1730.         QRT (Quick Ray Tracer) is an easy  to use image generation system
  1731.         that uses a ray tracing algorithm  for image rendering.  Versions
  1732.         exist for the Amiga personal  computer  and Data General MV10000.
  1733.         QRT overcomes many of the problems of other ray tracing packages,
  1734.         and is designed to operate nicely in a multi-tasking environment.
  1735.         
  1736.         
  1737.         COMPARISON TO OTHER SYSTEMS
  1738.         
  1739.         QRT was developed on the Amiga  personal  computer, so it will be
  1740.         compared to other Amiga ray tracers.  There are, to my knowledge,
  1741.         five other Amiga ray  tracers,  each  with  its own strengths and
  1742.         weaknesses.  I will describe each  system briefly, and compare it
  1743.         to QRT.  All the  Amiga  ray  tracers  can  operate  in HAM (4096
  1744.         color) mode.
  1745.         
  1746.            RT: RT was the first ray tracer written for the Amiga, by Eric
  1747.                Graham.  It will model a universe  made of only spheres, a
  1748.                sky, and a checkered or  solid  ground.   It is relatively
  1749.                fast, but not  generally  useful  for  realistic  modeling
  1750.                because of the sphere  limitation.   The input language is
  1751.                cryptic, although some error checking is done.  The system
  1752.                will only generate low resolution images.
  1753.         
  1754.           SILVER: I have never seen  SILVER,  so  I cannot say much about
  1755.                this system.
  1756.         
  1757.           SCULPT-3D: This package incorporates  an interactive editor for
  1758.                creating objects, and is  capable  of quickly generating a
  1759.                preliminary image of  the  scene  by  using hidden surface
  1760.                techniques.  However, every primitive is made of polygons,
  1761.                and some primitives such as  spheres  require  hundreds of
  1762.                polygons for a smooth texture,  so the ray tracing is very
  1763.                slow.  Also, the package takes a large amount of memory to
  1764.                run, and is prone to system crashes.  Its chief feature is
  1765.                the ability to  create  arbitrary  shaped  objects using a
  1766.                series of triangles.  Mirrored, dull, or shiny objects are
  1767.                supported.
  1768.         
  1769.           CLIGHT: This ray tracer  also  has  an  interactive editor, but
  1770.                produces very poor quality  images.   It is not capable of
  1771.                any patterning or reflection characteristics.
  1772.         
  1773.  
  1774.  
  1775.  
  1776.         QRT Ray Tracer               Page 1                   User Manual
  1777.  
  1778.  
  1779.  
  1780.  
  1781.  
  1782.  
  1783.  
  1784.  
  1785.  
  1786.  
  1787.  
  1788.  
  1789.           DBW: This is possibly the  most  complete  ray  tracer  for the
  1790.                Amiga.  It will support objects  with arbitrary degrees of
  1791.                reflection  and  gloss,   depth  of  field  effects,  some
  1792.                texturing, wavy surfaces, fractals,  transparent surfaces,
  1793.                diffuse propagation of light from  object to object, and 5
  1794.                primitive types (sphere, triangle, parallelogram, fractal,
  1795.                and ring).  The input language,  however, is so cryptic as
  1796.                to be nearly  incomprehensible,  and if there is any error
  1797.                in the input file, it will  crash  the system.  It is also
  1798.                painfully  slow;  some  images  take  16  to  24  hours to
  1799.                complete.
  1800.         
  1801.         QRT is meant to be  a  compromise  between  the  fast, simple ray
  1802.         tracers and the slow powerful systems.   It compares favorably in
  1803.         speed to RT, and in power  to  Sculpt-3d  or  DBW.  It has a very
  1804.         friendly input language with extensive  error checking.  Here are
  1805.         some features of QRT:
  1806.         
  1807.             o  Multiple primitive types, including user defined quadratic
  1808.                surfaces
  1809.         
  1810.             o  Arbitrary   levels   of   diffuse   reflection,   spectral
  1811.                reflection, transmission, ambient lighting, and gloss
  1812.         
  1813.             o  User defined pattern information for objects
  1814.         
  1815.             o  Bounding boxes for groups of objects
  1816.         
  1817.             o  Shadows
  1818.         
  1819.             o  Multiple light sources with different characteristics
  1820.         
  1821.             o  Arbitrary Phong spectral reflection coefficients
  1822.         
  1823.             o  Color dithering to increase the apparent number of colors
  1824.         
  1825.             o  Easy  to  use,  free  format  input  language  with  error
  1826.                checking.  Parameters are by keyword and may appear in any
  1827.                order.
  1828.         
  1829.             o  Supports medium resolution (128k dots/screen)
  1830.         
  1831.         Each of these features of QRT will be discussed is greater detail
  1832.         in this document.
  1833.         
  1834.         
  1835.         
  1836.         THE QRT WORLD
  1837.         
  1838.         QRT constructs an  image  of  the  world  by  performing  certain
  1839.         manipulations  on  an  internal  representation  of  a  group  of
  1840.  
  1841.  
  1842.         QRT Ray Tracer               Page 2                   User Manual
  1843.  
  1844.  
  1845.  
  1846.  
  1847.  
  1848.  
  1849.  
  1850.  
  1851.  
  1852.  
  1853.  
  1854.  
  1855.         objects.  You must provide a description  of these objects to QRT
  1856.         through the QRT input language.
  1857.         
  1858.         QRT writes a machine independent bitmap file which can be read by 
  1859.         a computer specific post  processor.   The  post processor either
  1860.         displays the  image  or  converts  it  into  the  proper form for
  1861.         display  by  system   programs.     (See  the  Machine  Dependent
  1862.         Information section of this manual for details).
  1863.         
  1864.         QRT is capable of dealing  with  5  types  of  primitive objects:
  1865.         spheres,   parallelograms,   triangles,   rings   (annulus),  and
  1866.         quadratic  surfaces.   The  latter  can  be  used to model cones,
  1867.         oblong spheroids, and other interesting  surfaces.  Each of these
  1868.         objects can have an arbitrary orientation in space, and arbitrary
  1869.         surface characteristics.
  1870.         
  1871.         
  1872.         
  1873.         QRT INPUT LANGUAGE
  1874.         
  1875.         The QRT input language is free  format,  in  that commands may be
  1876.         placed anywhere on a line,  and  newlines  may  be  placed at any
  1877.         point.  This makes it easy to use indentation.  Comments are also
  1878.         supported by surrounding  text  with  curly  braces  '{' and '}'.
  1879.         Comments may span lines.
  1880.         
  1881.         Once a file with QRT commands is built  (using any available text
  1882.         editor), qrt can be made to process these commands:
  1883.         
  1884.             QRT <commands.qrt
  1885.         
  1886.         where "commands.qrt" is the file containing  the input.  QRT also
  1887.         produces some statistics, so this  output can also be redirected.
  1888.         Since QRT runs for a long time, you  will probably want to run it
  1889.         as a background task with a low  priority.   So,  the full set of
  1890.         commands to run QRT would be:
  1891.         
  1892.             SetTaskPriority -5
  1893.             run QRT <commands.qrt >qrt.out
  1894.             SetTaskPriority 0
  1895.         
  1896.         This set of commands is specific to  the Commodore Amiga; see the
  1897.         Machine Dependent  Information  section  of  the manual for other
  1898.         operating systems.
  1899.         
  1900.         QRT will write a very large file, which may be anywhere from 400K 
  1901.         to  4  megabytes  depending  on  the  specific  computer  display
  1902.         resolution.  (See the Machine  Dependent  Information  section of
  1903.         this manual for the exact file  size).   There should be at least
  1904.         enough room on your disk to  accommodate  this  file. I recommend
  1905.         sending the output to a RAM disk,  so that the physical disk does
  1906.  
  1907.  
  1908.         QRT Ray Tracer               Page 3                   User Manual
  1909.  
  1910.  
  1911.  
  1912.  
  1913.  
  1914.  
  1915.  
  1916.  
  1917.  
  1918.  
  1919.  
  1920.  
  1921.         not get used for 60 minutes while QRT computes the image.
  1922.         
  1923.         A typical QRT  command  to  create  a  sphere  using  the default
  1924.         surface attributes would, be:
  1925.         
  1926.             SPHERE ( loc = (5,10,100)     { this is a white sphere }
  1927.                      radius = 12.5
  1928.                    )
  1929.         
  1930.         For comparison, the sphere command for DBW looks like this:
  1931.         
  1932.             s 0 0 0 1 0 0 0 .2 .2 .2 .8 .8 .8 5 10 100 12.5
  1933.         
  1934.         Or, in RT, the command would be:
  1935.         
  1936.             <1,1,1> 2 (5,10,100):1;
  1937.         
  1938.         The QRT input should be much  easier  to understand.  If QRT sees
  1939.         an error in its  input  file,  it  will  stop  and print the line
  1940.         number of the offending  line,  along  with  a  descriptive error
  1941.         message (ILLEGAL PARAMETER, etc).
  1942.         
  1943.         The QRT input language is not case sensitive.  A full description
  1944.         of the language and a shorter, context  free grammar can be found
  1945.         elsewhere in this manual.
  1946.         
  1947.         
  1948.         
  1949.         THE QRT ILLUMINATION MODEL
  1950.         
  1951.         Before meaningful images  can  be  created,  the QRT illumination
  1952.         model must be understood.  The  light  that  reaches the observer
  1953.         from each object is composed of several components:
  1954.         
  1955.            o  Diffuse light      - The "color" of the object
  1956.         
  1957.            o  Ambient light      - The color of the light that falls on
  1958.                                    the surface of the object if no lamps
  1959.                                    are shining on this spot.  Note that
  1960.                                    this specifies the color of light, not
  1961.                                    the color of the object itself.
  1962.         
  1963.            o  Reflected light    - If the object acts as a mirror, some
  1964.                                    light is reflected.
  1965.         
  1966.            o  Specular highlights - The "bright spots" of a shiny object
  1967.                                    viewed in a light.
  1968.         
  1969.            o  Transmitted light  - The object may transmit some of the
  1970.                                    light that strikes the back of the
  1971.                                    object (glass surfaces)
  1972.  
  1973.  
  1974.         QRT Ray Tracer               Page 4                   User Manual
  1975.  
  1976.  
  1977.  
  1978.  
  1979.  
  1980.  
  1981.  
  1982.  
  1983.  
  1984.  
  1985.  
  1986.  
  1987.         
  1988.         All of  these  light  characteristics  can  be  specified for any
  1989.         object.  If none are specified, the current defaults are assumed.
  1990.         These defaults can be changed (see  DEFAULT in Language Reference
  1991.         Guide).
  1992.         
  1993.         Most of these  light  characteristics  deal  with a percentage of
  1994.         light.  For example, a  light  may  reflect  80% of the red light
  1995.         that strikes it, 20% of the green,  and 40% of the blue.  This is
  1996.         the "color" of the object (diffuse light), and would be specified
  1997.         in QRT by the following syntax:
  1998.         
  1999.                       diff = (.80, .20, .40)
  2000.         
  2001.         In QRT, 1.00 is 100%.  The  language  is also free-format, so the
  2002.         above is equivalent to:
  2003.         
  2004.                       diff = (.80,
  2005.                               .20,
  2006.                               .40 )
  2007.         
  2008.         The commas between parameters  are  optional,  but make the input
  2009.         easier to read.  Semicolons can also be used.
  2010.         
  2011.         Ambient light is specified in a similar manner:
  2012.         
  2013.                       amb = (.20, .20, .20)
  2014.         
  2015.         The ambient light  values  should  be  fairly small.  Most of the
  2016.         light hitting the object comes from  lamps, but some parts of the
  2017.         object may be in the shadow  of  another  object.   If no ambient
  2018.         light is specified,  these  shadows  will  appear  totally black,
  2019.         which looks unrealistic.  Ambient light will give the affect of a
  2020.         small amount of light hitting areas in a shadow, producing a more
  2021.         realistic looking image.
  2022.         
  2023.         Reflection is specified using the MIRROR attribute:
  2024.         
  2025.                       mirror = (.90, .90, .90)
  2026.         
  2027.         If a true mirrored surface is  desired,  the mirror values should
  2028.         be fairly high.  If one of the values has a higher value than the
  2029.         others, the mirror will appear red, green, or blue.
  2030.         
  2031.         Transmission is specified as follows:
  2032.         
  2033.                       trans = (.80, .80, .80)
  2034.                       index = 120
  2035.         
  2036.         Note the addition of another parameter,  the index of refraction.
  2037.         An explanation of the index of refraction for an object is beyond
  2038.  
  2039.  
  2040.         QRT Ray Tracer               Page 5                   User Manual
  2041.  
  2042.  
  2043.  
  2044.  
  2045.  
  2046.  
  2047.  
  2048.  
  2049.  
  2050.  
  2051.  
  2052.  
  2053.         the scope of this document - see a  book on elementary optics for
  2054.         details.
  2055.         
  2056.         In  addition,   specular   highlights   are  specified  with  two
  2057.         parameters:
  2058.         
  2059.                       reflect  = .50,
  2060.                       sreflect = 45
  2061.         
  2062.         "REFLECT" is the percentage of  light  reflected  in the specular
  2063.         highlight,  and  sreflect   is   the  Phong  spectral  reflection
  2064.         coefficient.  Again, an  explanation  of the Phong coefficient is
  2065.         beyond the scope of this  document;  however,  a higher value for
  2066.         the coefficient will result in smaller,  tighter highlights for a
  2067.         more metallic looking object.  Lower values of sreflect should be
  2068.         accompanied by lower values in  reflect,  and will produce duller
  2069.         looking surfaces, such as paper.
  2070.         
  2071.         QRT also accepts a dithering amount for each object:
  2072.         
  2073.                       dither = 3
  2074.         
  2075.         Dithering is a mechanism for  simulating  colors not available on
  2076.         the display by blending  other  colors.   The  default  dithering
  2077.         coefficient is 3; it should be kept  small.  Values of 1 to 6 are
  2078.         good.  Larger objects should employ  more dithering, and mirrored
  2079.         or glass objects should have little or no dithering.
  2080.         
  2081.         QRT also accepts an attribute "FUZZ", but this is not used in the
  2082.         present implementation.  In a future  implementation of QRT, FUZZ
  2083.         will effect small, random perturbations of the normal vector at a
  2084.         given location on an object.  This  will simulate rough surfaces,
  2085.         matted glass, or imperfectly reflecting mirrors.
  2086.         
  2087.         All of the above  light  characteristics  may  be attached to any
  2088.         object.   The  default  is  for  a  white,  non  reflecting,  non
  2089.         transmitting dull surface with an average amount of dithering. In
  2090.         addition, any of  the  above  color  information  (which  will be
  2091.         referred to from now on as  COLORINFO)  may also be attached to a
  2092.         pattern structure (see the PATTERN section of this document).
  2093.         
  2094.         
  2095.         
  2096.         LIGHT SOURCES
  2097.         
  2098.         Light sources in QRT are called  "LAMPS".   The lamp structure is
  2099.         simple:
  2100.         
  2101.                      LAMP ( loc = (12, 34, 56),
  2102.                             dist = 50,
  2103.                             radius = 10 )
  2104.  
  2105.  
  2106.         QRT Ray Tracer               Page 6                   User Manual
  2107.  
  2108.  
  2109.  
  2110.  
  2111.  
  2112.  
  2113.  
  2114.  
  2115.  
  2116.  
  2117.  
  2118.  
  2119.         
  2120.         The default is for a bright white lamp, but if you wish to change
  2121.         this, you can  specify  different  values  for the lamp's ambient
  2122.         light.  The radius value  is  ignored  by  this implementation of
  2123.         QRT, but it must be supplied.   In  a  future version, the radius
  2124.         may be used to  implement  penumbral  shadows.   I didn't include
  2125.         them in  this  version,  since  they  take  a  very  long time to
  2126.         compute, and don't add much to the image quality.
  2127.         
  2128.         The "dist" entry in the lamp structure specifies at what distance
  2129.         the light from the lamp is at full intensity.  Beyond this value,
  2130.         the light will decrease in  intensity.   This value should be set
  2131.         so that the nearest object  in  the  scene  is slightly more than
  2132.         "dist" distance units from the  lamp.   This  does not have to be
  2133.         exact. If objects are nearer  than  dist"  units, they will be so
  2134.         bright that shading will not  take  place.  Objects very far away
  2135.         will be dimly illuminated.
  2136.         
  2137.         By the way, QRT distance  units  are  not  tied to any real world
  2138.         unit.  They can stand for feet,  nautical  miles, or furlongs, at
  2139.         your choice.
  2140.         
  2141.         
  2142.         
  2143.         THE OBSERVER
  2144.         
  2145.         After defining the world,  you  must  tell  QRT  the position and
  2146.         orientation of the observer.  This is done as follows:
  2147.         
  2148.                  OBSERVER ( loc     = (0, 10,  20),
  2149.                             lookat  = (5,  5, 120),
  2150.                             up      = (0,  1,   0)
  2151.                           )
  2152.         
  2153.         The x,y, and z are the location  of  the  observer.  The "lookat"
  2154.         variables give a location in  space  that the observer is looking
  2155.         at.  Most ray tracers  require  you  to  give  two angles for the
  2156.         observers view  direction,  but  it  is  MUCH  easier to know the
  2157.         location of an object or point in  space you wish the observer to
  2158.         look at.  This will be the center of your scene.
  2159.         
  2160.         The "up" variables define which  direction  is  up.  Usually, you
  2161.         will wish to use the values  given  above.  QRT uses a right hand
  2162.         coordinate system: positive  y  is  up,  positive z is out of the
  2163.         screen, and positive x is to the right  if you are looking in the
  2164.         negative z direction.   The  "up"  parameter  is optional, and if
  2165.         omitted, defaults to (0,1,0).
  2166.         
  2167.         QRT will generate an error message if no observer is defined.
  2168.         
  2169.         
  2170.  
  2171.  
  2172.         QRT Ray Tracer               Page 7                   User Manual
  2173.  
  2174.  
  2175.  
  2176.  
  2177.  
  2178.  
  2179.  
  2180.  
  2181.  
  2182.  
  2183.  
  2184.  
  2185.         
  2186.         OUTPUT FILENAME
  2187.         
  2188.         QRT places its output in a file, so  you must give it the name of
  2189.         this file:
  2190.         
  2191.                       FILE_NAME = outfile.tmp
  2192.         
  2193.         This file must  observe  any  file  naming  restrictions  of  the
  2194.         operating system and  computer  you  are  using.  See the Machine
  2195.         Dependent Information section  of  this manual for information on
  2196.         file naming restrictions.
  2197.         
  2198.         
  2199.         
  2200.         FOCAL LENGTH
  2201.         
  2202.         This is the focal length  of  the  "lens"  used  by the observer.
  2203.         Think of it as a 35mm  camera  lens  -  higher  numbers produce a
  2204.         telephoto effect, and smaller numbers  are for wide angle lenses.
  2205.         Note that small numbers may produce some distortion of the  image
  2206.         around the edges.
  2207.         
  2208.                       FOC_LENGTH = 60
  2209.         
  2210.         
  2211.         
  2212.         SCAN RANGE
  2213.         
  2214.         If you do not want QRT to produce  a whole image, you can specify
  2215.         the first and last scan  lines.    The  parameters should be less
  2216.         than the maximum Y resolution of your display.
  2217.         
  2218.                       FIRST_SCAN = 100
  2219.                       LAST_SCAN  = 300
  2220.         
  2221.         This is useful for quickly generating part of an image.
  2222.         
  2223.         
  2224.         
  2225.         SKY AND GROUND
  2226.         
  2227.         QRT has facilities for generating  the sky and ground.  To define
  2228.         the sky, you must give it two  colors  - one for the sky overhead
  2229.         (zenith), and one for the horizon:
  2230.         
  2231.                       SKY ( zenith  = (.10, .2, .4),
  2232.                             horiz   = (.10, .2, .65),
  2233.                             dither   = 6
  2234.                       )
  2235.         
  2236.  
  2237.  
  2238.         QRT Ray Tracer               Page 8                   User Manual
  2239.  
  2240.  
  2241.  
  2242.  
  2243.  
  2244.  
  2245.  
  2246.  
  2247.  
  2248.  
  2249.  
  2250.  
  2251.         This will produce a blue  sky,  with  a  brighter  color near the
  2252.         horizon.  (The sky need not  be  blue  -  it  could be red or hot
  2253.         pink, or vary from red to  green).   QRT  will smoothly blend the
  2254.         colors from the zenith  to  the  horizon.   Since  the  sky is so
  2255.         large, you may want to specify  a  greater amount of dithering to
  2256.         compensate for the displays color resolution limit.
  2257.         
  2258.         The SKY structure will also produce sky colors below the horizon;
  2259.         any ray that does not strike an  object  will strike the SKY.  To
  2260.         fix this, define a ground.  There is no dedicated GROUND command,
  2261.         since you can define a  very  large  parallelogram  with the same
  2262.         effect.  You can make it  brown  with  patches  of  green using a
  2263.         PATTERN, or checkered green and yellow in the classic ray-tracing
  2264.         ground pattern.
  2265.         
  2266.         
  2267.         
  2268.         BOUNDING BOXES
  2269.         
  2270.         QRT supports the use of  bounding  boxes to speed the ray tracing
  2271.         process.  For images  composed  of  only  a few (1 to 3) objects,
  2272.         bounding boxes will not do much to  increase speed.  However, for
  2273.         images where there are groups of objects physically close to each
  2274.         other, they can greatly reduce  execution  times.  A bounding box
  2275.         is a conceptual structure that encloses a group of objects.  When
  2276.         the ray tracer is finding  line/object  intersections,  if a line
  2277.         does not strike a  bounding  box,  it  cannot possibly strike any
  2278.         objects within that bounding box.   This saves the ray tracer the
  2279.         trouble of  checking  intersections  with  all objects within the
  2280.         box.  In the  case  where  the  ray  DOES  enter  the  box,  some
  2281.         additional overhead  is  incurred;  however,  this cost is easily
  2282.         justified by reduced times for negative tests.
  2283.         
  2284.         Bounding boxes can occasionally  be  useful  for complex objects,
  2285.         such as quadratic  surfaces,  when  the  object  is fairly small.
  2286.         Since the time to find the intersection  with a quadratic surface
  2287.         is large, but bounding box intersections are fast, the ray tracer
  2288.         can save time for all the negative tests.
  2289.         
  2290.  
  2291.  
  2292.  
  2293.  
  2294.  
  2295.  
  2296.  
  2297.  
  2298.  
  2299.  
  2300.  
  2301.  
  2302.  
  2303.  
  2304.         QRT Ray Tracer               Page 9                   User Manual
  2305.  
  2306.  
  2307.  
  2308.  
  2309.  
  2310.  
  2311.  
  2312.  
  2313.  
  2314.  
  2315.  
  2316.  
  2317.         Bounding boxes can contain  other  bounding boxes, in a recursive
  2318.         manner.  This recursive structure defines an "object tree". There
  2319.         are two keywords that define the beginning  and end of a bounding
  2320.         box: BEGIN_BBOX and END_BBOX.  Here is an example:
  2321.         
  2322.         
  2323.             { ** QRT Code for a chessman ** }
  2324.         
  2325.             BEGIN_BBOX
  2326.         
  2327.                 QUADRATIC (  { ** quadr defn ** }
  2328.                           )
  2329.         
  2330.                 QUADRATIC (  { ** quadr defn 2 ** }
  2331.                           )
  2332.         
  2333.                 SPHERE    (  { ** sphere defn ** }
  2334.                           )
  2335.         
  2336.                 BEGIN_BBOX
  2337.         
  2338.                     SPHERE ( )    { ** two spheres ** }
  2339.                     SPHERE ( )
  2340.         
  2341.                 END_BBOX
  2342.         
  2343.             END_BBOX
  2344.         
  2345.         This structure may be nested to an  arbitrary level; if you had a
  2346.         closely spaced group of  chessmen,  you could enclose all of them
  2347.         with a bounding box.
  2348.         
  2349.         
  2350.         
  2351.         PATTERNS
  2352.         
  2353.         QRT permits user  defined  patterns  which  can  be mapped to the
  2354.         surface of any  object.   A  pattern  is  basically  an organized
  2355.         method for changing  an  object's  COLORINFO  over the surface of
  2356.         that object.  For example, a checkered surface can be created, or
  2357.         a surface given the  appearance  of  brick  or tile.  The current
  2358.         patterning in QRT is  limited,  yet  powerful  enough to describe
  2359.         many common patterns.
  2360.         
  2361.         A  pattern  is  composed  of  a  series  of  sub-patterns.   Each
  2362.         sub-pattern defines a region on  the  surface  of an object which
  2363.         will contain a  given  COLORINFO.   These  regions  are presently
  2364.         limited to  rectangles,  but  this  may  be  expanded in a future
  2365.         implementation of QRT.
  2366.         
  2367.  
  2368.  
  2369.  
  2370.         QRT Ray Tracer               Page 10                  User Manual
  2371.  
  2372.  
  2373.  
  2374.  
  2375.  
  2376.  
  2377.  
  2378.  
  2379.  
  2380.  
  2381.  
  2382.  
  2383.         A pattern can be defined once,  and  used  for many objects.  For
  2384.         example, a brick pattern might be defined:
  2385.         
  2386.                   PATTERN ( name = BRICK,
  2387.                             { ** other pattern info here ** }
  2388.                           )
  2389.         
  2390.                   SPHERE  ( { ** sphere definition ** }
  2391.                             pattern = BRICK
  2392.                           )
  2393.         
  2394.                   PARALLELOGRAM ( { ** parallelogram definition ** }
  2395.                                   pattern = BRICK
  2396.                                 )
  2397.         
  2398.         This example ignores what is  actually  in the pattern definition
  2399.         to demonstrate how patterns are  attached  to objects.  A pattern
  2400.         must be defined before it can be used.   It is given a name, such
  2401.         as BRICK, and any object can specify this pattern with "PATTERN =
  2402.         BRICK".  There are  no  practical  restrictions  on the length of
  2403.         pattern names (if your computer has 1 megabyte of ram, you cannot
  2404.         have a pattern name longer than 1  million characters).  Multiple
  2405.         patterns may be defined at the top of an input file, and used for
  2406.         any object in the file.
  2407.         
  2408.         What exactly makes  up  a  pattern,  you  ask?   A pattern can be
  2409.         viewed as a rectangle that  is  repeated  over  the surface of an
  2410.         object.  If the pattern size is  10  x 10, and you have an object
  2411.         (say a parallelogram) that is 50 x  50, the pattern will repeat 5
  2412.         times in each direction.   Within  this  repeating rectangle, sub
  2413.         patterns can be defined.  A sub-pattern  is a rectangle or circle
  2414.         within the pattern rectangle with a certain COLORINFO. Any number
  2415.         of  these  sub-patterns   can   be  created  within  one  pattern
  2416.         definition. To create a  brick  wall,  you  might  define several
  2417.         sub-patterns, each with  a  slightly  different  color  of red or
  2418.         brown.  The sub  patterns  need  not  cover  the  entire  pattern
  2419.         rectangle; if they do not,  the  COLORINFO  you  defined  for the
  2420.         object is used instead of the pattern  COLORINFO.  If you defined
  2421.         sub-patterns for bricks, the  area  not  covered would be mortar,
  2422.         and the objects COLORINFO would  define  the color of the mortar.
  2423.         An actual brick pattern is  given  in appendix C.  The proper use
  2424.         of patterns can be very effective  in producing realistic looking
  2425.         scenes.  However, complicated patterns  will slow image creation,
  2426.         so it is recommended that you  first  display test scenes with no
  2427.         patterns, and then add  pattern  information  when  the  scene is
  2428.         right.
  2429.         
  2430.  
  2431.  
  2432.  
  2433.  
  2434.  
  2435.  
  2436.         QRT Ray Tracer               Page 11                  User Manual
  2437.  
  2438.  
  2439.  
  2440.  
  2441.  
  2442.  
  2443.  
  2444.  
  2445.  
  2446.  
  2447.  
  2448.  
  2449.         INSTANCES
  2450.         
  2451.         Often, several copies  of  a  complex  object  must  be  created.
  2452.         Specifying  their  component   primitives   each  time  would  be
  2453.         difficult. There is a solution to both these problems: INSTANCES.
  2454.         An INSTANCE is a method by which several primitives (actually, an
  2455.         arbitrary object tree) can be  grouped  and given a name.  Copies
  2456.         of these objects may be easily created with one command.  Here is
  2457.         an example of an instance definition.
  2458.         
  2459.                 BEGIN_INSTANCES
  2460.         
  2461.                     NAME = object1
  2462.                     BEGIN_BBOX
  2463.                         { ** a bunch of primitives here ** }
  2464.                     END_BBOX
  2465.         
  2466.                     NAME = object2
  2467.                     BEGIN_BBOX
  2468.                         { ** a bunch more primitives  here ** }
  2469.         
  2470.                         NAME = spheres
  2471.                         BEGIN_BBOX
  2472.                           SPHERE ( )  { ** two sphere definitions ** }
  2473.                           SPHERE ( )
  2474.                         END_BBOX
  2475.         
  2476.                     END_BBOX
  2477.         
  2478.                 END_INSTANCES
  2479.         
  2480.         There can be only one of these instance  definitions, and it must
  2481.         appear before any  instances  are  used.   However, any arbitrary
  2482.         object tree can appear within the  begin/end instance statements.
  2483.         Several instances are now available for use.  For example:
  2484.         
  2485.                 INSTANCE_OF (  name = object1,
  2486.                                loc  = (100, 10, 20),
  2487.                             )
  2488.         
  2489.                 INSTANCE_OF (  name = spheres,
  2490.                                loc  = (12.3, 24.5, 999)
  2491.                             )
  2492.         
  2493.         This example shows that any  named  portion of the object subtree
  2494.         can function as an instance  (the  "spheres" object is at a lower
  2495.         level than the "object1'  object).   The  "offset" parameters are
  2496.         required.  They specify a new  position  for the instance (offset
  2497.         from the  origin).   In  the  instance  definition  segment,  all
  2498.         objects are defined relative to 0,0,0.  They can then be moved in
  2499.         the INSTANCE_OF statement with the offset command.
  2500.  
  2501.  
  2502.         QRT Ray Tracer               Page 12                  User Manual
  2503.  
  2504.  
  2505.  
  2506.  
  2507.  
  2508.  
  2509.  
  2510.  
  2511.  
  2512.  
  2513.  
  2514.  
  2515.         
  2516.         In addition, the instance can be given a new size:
  2517.         
  2518.                 INSTANCE_OF (  name    = object2,
  2519.         
  2520.                                loc     = (200, 100, 50),
  2521.                                scale   = (1.5, 2.0, .25)
  2522.                             )
  2523.         
  2524.         The scale factors are optional,  and  are given the default of 1.
  2525.         The instance will be resized by  the  indicated amount in each of
  2526.         the directions.  Note that  there  are some restrictions to this:
  2527.         if spheres are given a different scale  factor in each direction,
  2528.         they will remain spheres (not  change  to  QUADRATIC types).  The
  2529.         new radius will be the old  radius  scaled by the smallest of the
  2530.         scale factors.
  2531.         
  2532.         
  2533.         
  2534.         DEFAULTS
  2535.         
  2536.         Each object  in  QRT  is  given  certain  default  surface  light
  2537.         characteristics (see the section on surface characteristics).  If
  2538.         these defaults are  not  suitable,  they  can be changed with the
  2539.         DEFAULT command:
  2540.         
  2541.                 DEFAULT ( diff = (1.00, .1, .1)
  2542.                           no_shadow )
  2543.         
  2544.         This will make all future objects red unless specified otherwise.
  2545.         More than one default  command  can  be  used in a file: each one
  2546.         affects all the  objects  created  after  it, but before the next
  2547.         default  command.   Any  light  characteristics  can  be  changed
  2548.         (MIRROR, DITHER, etc).
  2549.         
  2550.         In addition, the keyword "no_shadow"  can be included (as above).
  2551.         Ordinarily, QRT computes shadow information for all objects. This
  2552.         takes a lot  of  time,  especially  for  scenes  composed of many
  2553.         objects and many lamps.  The  "no_shadow"  command  causes QRT to
  2554.         bypass the shadow routines.   This  will  result in a much faster
  2555.         image  generation  time,   but  the  picture  will  not  look  as
  2556.         realistic.
  2557.         
  2558.  
  2559.  
  2560.  
  2561.  
  2562.  
  2563.  
  2564.  
  2565.  
  2566.  
  2567.  
  2568.         QRT Ray Tracer               Page 13                  User Manual
  2569.  
  2570.  
  2571.  
  2572.  
  2573.  
  2574.  
  2575.  
  2576.  
  2577.  
  2578.  
  2579.  
  2580.  
  2581.         PROBLEMS WITH QRT
  2582.         
  2583.         There are several limitations in this version of QRT:
  2584.         
  2585.             o  Patterning  does  not   work   well  with  some  quadratic
  2586.                surfaces.  This is  a  problem  with  the 3d to 2d mapping
  2587.                function used for quadratics.
  2588.         
  2589.             o  Patterns  do  not   support   circular  or  non-orthogonal
  2590.                rectangular   sub-patterns.   This   would   slow  pattern
  2591.                processing        but increase the utility of patterns.
  2592.         
  2593.             o  User defined texturing is not implemented - all objects in
  2594.                QRT appear  smooth.   I  have  some  ideas  on  how to add
  2595.                textures to objects, but  these  have  not been tested and
  2596.                are not incorporated into this version of QRT.
  2597.         
  2598.             o  Some rounded objects such as  spheres  appear distorted if
  2599.                they are near the edge of the image.  This is a bug in the
  2600.                routine that creates a ray for a given pixel position.
  2601.         
  2602.         
  2603.         
  2604.         FUTURE ENHANCEMENTS TO QRT
  2605.         
  2606.         The following are some things I'd like to add to QRT:
  2607.         
  2608.             o  Enhanced  patterning   capability.    This  could  include
  2609.                arbitrary polygonal  patterns,  and non-orthogonal shapes.
  2610.                Also, the ability to use enumerated  (bit-mapped) patterns
  2611.                as well as analytic patterns would be useful.
  2612.         
  2613.             o  Anti-dithering   routines.     These  routines   are  very
  2614.                computationally   expensive   (they   can  increase  image
  2615.                generation times by a factor of  3 to 5), so they were not
  2616.                included in this version.
  2617.         
  2618.             o  Penumbral shadows.   This  is  also  very  computationally
  2619.                expensive for a minimal utility  level, so I didn't bother
  2620.                to include this feature.
  2621.         
  2622.             o  Fractal generation.  Fractals are,  again, computationally
  2623.                expensive, but some things,  such  as mountains, cannot be
  2624.                modeled with a ray tracer any other way.
  2625.         
  2626.             o  Wavy surfaces.  This is useful for modeling water, rippled
  2627.                mirrors, etc.  I know  how  to  do  it, I just didn't have
  2628.                time to add it yet.  It  would  be  nice if the waves were
  2629.                user definable in amplitude and  x and y wavelength.  Wavy
  2630.                surfaces are very similar in implementation to textures.
  2631.         
  2632.  
  2633.  
  2634.         QRT Ray Tracer               Page 14                  User Manual
  2635.  
  2636.  
  2637.  
  2638.  
  2639.  
  2640.  
  2641.  
  2642.  
  2643.  
  2644.  
  2645.  
  2646.  
  2647.             o  Snowy surfaces.  This is an idea from DBW, which adds snow
  2648.                to a surface depending on its slope and altitude.
  2649.         
  2650.             o  Interpolated  normal  surfaces.   This  is  a mechanism to
  2651.                model  arbitrary  curved  surfaces  by  using  a polygonal
  2652.                approximation to the surface, and interpolating the normal
  2653.                vector between surfaces to avoid angular looking surfaces.
  2654.         
  2655.             o  Image  plane  object  lists.    This  is  a  technique for
  2656.                increasing the speed for positive line/object intersection
  2657.                test.  (Bounding  boxes   increase   speed   for  negative
  2658.                line/object intersection tests). 
  2659.         
  2660.             o  Heuristics for  faster  completion  of  images  using area
  2661.                coherence.
  2662.         
  2663.             o  An  interactive  editor.   This  is  another  large  scale
  2664.                project in itself, and I can't forsee having time to do it
  2665.                for a long time, but it would be useful.  The editor would
  2666.                display a preliminary  image  of  the  scene, and when the
  2667.                user had placed objects  to  his  satisfaction,  it  would
  2668.                write a QRT input file and call  QRT as a background task.
  2669.                There are certain problems here - for instance, how do you
  2670.                quickly generate the outline  of  a user defined quadratic
  2671.                that can take many forms  (cone,  spheroid, etc)?  And how
  2672.                can the user  easily  specify  the  object  tree structure
  2673.                (bounding boxes) with an interactive editor?
  2674.         
  2675.  
  2676.  
  2677.  
  2678.  
  2679.  
  2680.  
  2681.  
  2682.  
  2683.  
  2684.  
  2685.  
  2686.  
  2687.  
  2688.  
  2689.  
  2690.  
  2691.  
  2692.  
  2693.  
  2694.  
  2695.  
  2696.  
  2697.  
  2698.  
  2699.  
  2700.         QRT Ray Tracer               Page 15                  User Manual
  2701.  
  2702.  
  2703.  
  2704.  
  2705.  
  2706.  
  2707.  
  2708.  
  2709.  
  2710.  
  2711.  
  2712.  
  2713.         
  2714.         
  2715.         
  2716.                            Addendum to QRT Version 1.2
  2717.         
  2718.         
  2719.         
  2720.         The following are changes to QRT made since version 1.1
  2721.         
  2722.         Additions and Enhancements
  2723.         
  2724.            Polygon Primitive Added to Pattern Command
  2725.                
  2726.                Patterns in version 1.1 could  include only rectangles and
  2727.                circles;  a  new  polygon  command  vastly  increases  the
  2728.                utility of the  pattern  command.   Polygons  may have any
  2729.                number of points (at least  three),  but a large number of
  2730.                points will increase the time 
  2731.                taken for the  containment  test,  and  hence  the time to
  2732.                complete the image.  A fast containment algorithm is used,
  2733.                but it is still linear  in  the  number  of  points in the
  2734.                polygon.  A practical limit 
  2735.                might be 30 to 40 points (split amoung all polygons in the
  2736.                pattern).
  2737.                
  2738.                In order for the polygon command to operate correctly, the
  2739.                first point must be the same as the last point.  ex:
  2740.                
  2741.                      PATTERN ( name    = TRIANGLE_TEST
  2742.                                x_size  = 6
  2743.                                y_size  = 6
  2744.                
  2745.                                POLYGON (
  2746.                                  POINT = (0 , 0)
  2747.                                  POINT = (5 , 0)
  2748.                                  POINT = (2.5,5)
  2749.                                  POINT = (0 , 0)  { same as 1st pt }
  2750.                
  2751.                                  { ** any number of additional points
  2752.                                       could be added here ** }
  2753.                                )
  2754.                
  2755.                                { ** more polygons or other pattern
  2756.                                     primitives could come here     ** }
  2757.                              )
  2758.                
  2759.                Polygon primitives may be  mixed  in a pattern with either
  2760.                circles or rectangles.   If  a  rectangle  is desired, the
  2761.                rectangle primitive is faster than a four point polygon.
  2762.                
  2763.                
  2764.  
  2765.  
  2766.         QRT Ray Tracer               Page 1               Addendum to 1.2
  2767.  
  2768.  
  2769.  
  2770.  
  2771.  
  2772.  
  2773.  
  2774.  
  2775.  
  2776.  
  2777.  
  2778.  
  2779.         Bug Report
  2780.         
  2781.            One bug found in version 1.1  has  been  fixed.  The shadowing
  2782.            routine in version 1.1  did  not  operate  quite correctly:  a
  2783.            point was  (incorrectly)  computed  as  being in a shadow if a
  2784.            line drawn from the point to  the  lamp  intersected an object
  2785.            even on the other side  of  the  lamp.   The  test should have
  2786.            looked at objects only on  the  same  side  of the lamp as the
  2787.            point in question.  This  was giving  extra shadows in strange
  2788.            places, and has been fixed in this version.
  2789.            
  2790.            
  2791.         Planned extentions for 1.3
  2792.         
  2793.            Version 1.3 will probably  include  a  better lexical analyser
  2794.            that can cope  with  nested  comments  and  possibly  #include
  2795.            files.  The  #include  directive  would  enable one to amass a
  2796.            file of often  used  patterns,  for  example.   The  parser is
  2797.            plenty fast enough (between 2  and  3 hundred lines per second
  2798.            from RAM:) to make this practical.
  2799.            
  2800.            
  2801.         Hints, Tips, etc.
  2802.         
  2803.            Try using a general purpose macro processor to pre-process QRT
  2804.            input. #define BRICK_RED  (.8,  .2,  .1),  for example, or use
  2805.            parameter macros to  #define  CYLENDER  (height,  diameter) to
  2806.            elimiate the need for entering quadratic coeficcients.  (I may
  2807.            add CYLENDER, CONE, and SPHEREOID commands to a future version
  2808.            of QRT.  They would  simply  map  into  the  current quadratic
  2809.            primitive, but make QRT easier to use).
  2810.              
  2811.  
  2812.  
  2813.  
  2814.  
  2815.  
  2816.  
  2817.  
  2818.  
  2819.  
  2820.  
  2821.  
  2822.  
  2823.  
  2824.  
  2825.  
  2826.  
  2827.  
  2828.  
  2829.  
  2830.  
  2831.  
  2832.         QRT Ray Tracer               Page 2               Addendum to 1.2
  2833.  
  2834.  
  2835.  
  2836.  
  2837.  
  2838.  
  2839.  
  2840.  
  2841.  
  2842.  
  2843.  
  2844.  
  2845.         
  2846.         
  2847.         
  2848.                            Addendum to QRT Version 1.3
  2849.         
  2850.         
  2851.         
  2852.         The following are changes to QRT made since version 1.2
  2853.         
  2854.         Additions and Enhancements
  2855.         
  2856.            'Remove' Command Added
  2857.                
  2858.                The 'REMOVE' command  was  added  to  allow  sections of a
  2859.                planar primitive to be removed.  This makes it much easier
  2860.                to create flat  objects  that  are  not  shaped like QRT's
  2861.                planar primitives.  For  example,  I  had a QRT input file
  2862.                which created the image of a grand  piano.  The top of the
  2863.                piano, because of its complex shape, initially was created
  2864.                from 11 planar primitives.  Now, it is only 
  2865.                1   PARALLELOGRAM   primitive,   and   a  section  of  the
  2866.                parallelogram is removed to  create  the  shape of a piano
  2867.                top.
  2868.                
  2869.                Before the REMOVE command  can  be used, a pattern must be
  2870.                created using any of QRT's  pattern  primitives (the piano
  2871.                uses a polygon). 
  2872.                This pattern need not be given any surface characteristics
  2873.                - it simply defines  the  region  to  be  removed from the
  2874.                planar  primitive.   The   pattern   is  attached  to  the
  2875.                primitive in exactly  the  same  way  as a normal pattern,
  2876.                except that the  REMOVE  command  is  used  instead of the
  2877.                PATTERN command:
  2878.                
  2879.                    PARALLELOGRAM ( loc = (0, 0, 0)
  2880.                                    v1  = (10, 0, 0)
  2881.                                    v2  = (0, 0, 10)
  2882.                
  2883.                                    diff    = (1, 0, 0)
  2884.                                    remove  = SECTION_TO_REMOVE
  2885.                                    pattern = ANY_PATTERN
  2886.                                  )
  2887.                
  2888.                This example shows that the PATTERN command can be used on
  2889.                the  same primive as the REMOVE command.
  2890.                
  2891.                Several things should be  noted  about the REMOVE command.
  2892.                First, the pattern defines the sections to remove, not the
  2893.                sections which will  remain.    In  the piano example, the
  2894.                pattern mapped all of the  parallelogram  except  the part
  2895.                that composed the actual  piano  top.  Second, even though
  2896.  
  2897.  
  2898.         QRT Ray Tracer               Page 1               Addendum to 1.3
  2899.  
  2900.  
  2901.  
  2902.  
  2903.  
  2904.  
  2905.  
  2906.  
  2907.  
  2908.  
  2909.  
  2910.  
  2911.                the remove command can  be  used  with  the curved surface
  2912.                primitives (SPHERE,  QUADRATIC),  the  results will not be
  2913.                quite right.  To use the  sphere  as an example, the front
  2914.                surface of  the  sphere  would  have  the  correct pattern
  2915.                removed from it, but the back surface of the sphere would 
  2916.                be completely gone.  This is because  the SPHERE intersect
  2917.                routine ignores completely the back surface of the sphere.
  2918.                I will probably fix this in a future version.
  2919.                
  2920.            Nested Comments
  2921.                
  2922.                Comments may  now  be  nested.   This  makes  it easier to
  2923.                comment out blocks of QRT  code  which  themselves contain
  2924.                comments.
  2925.                
  2926.                
  2927.         Planned extentions for 1.4
  2928.         
  2929.            I had planned to create an "#INCLUDE" command for version 1.3,
  2930.            but instead I worked on  the  REMOVE  command  (it seemed more
  2931.            important).  #INCLUDE will probably be coming next time.
  2932.               
  2933.  
  2934.  
  2935.  
  2936.  
  2937.  
  2938.  
  2939.  
  2940.  
  2941.  
  2942.  
  2943.  
  2944.  
  2945.  
  2946.  
  2947.  
  2948.  
  2949.  
  2950.  
  2951.  
  2952.  
  2953.  
  2954.  
  2955.  
  2956.  
  2957.  
  2958.  
  2959.  
  2960.  
  2961.  
  2962.  
  2963.  
  2964.         QRT Ray Tracer               Page 2               Addendum to 1.3
  2965.  
  2966.  
  2967.  
  2968.  
  2969.  
  2970.  
  2971.  
  2972.  
  2973.  
  2974.  
  2975.  
  2976.  
  2977.         
  2978.         
  2979.         
  2980.                            Addendum to QRT Version 1.4
  2981.         
  2982.         
  2983.         
  2984.         The following are changes to QRT made since version 1.3
  2985.         
  2986.         Additions and Enhancements
  2987.         
  2988.            Transmission
  2989.                
  2990.                Transmission of light through surfaces now works, allowing
  2991.                one to  model  glass  surfaces.   Some  additions  to  and
  2992.                changes  from  the  original  grammar  were  necessary  to
  2993.                provide  the  desired   functionality.    A  new  keyword,
  2994.                "DENSITY", has been  added,  and  the  function of the old
  2995.                "TRANS" keyword has  been  changed.   Also,  a "THRESHOLD"
  2996.                parameter has been added to the  default structure.  Since
  2997.                transmission is a complex operation,  this entire Addendum
  2998.                will discuss aspects of modeling glass surfaces.
  2999.                
  3000.            The DENSITY keyword
  3001.                
  3002.                It was my previous  intent  that  the  TRANS keyword would
  3003.                specify  the  percent  transmission  of  light  though the
  3004.                surface.  After thinking a little more about the nature of
  3005.                light  transmission,  it   was   clear  that  this  wasn't
  3006.                adequate.  The amount  of  light  transmitted  depends not
  3007.                only on a fixed  coefficient  of  the  surface, but on the
  3008.                thickness of the  surface.   For  example,  a hollow glass
  3009.                sphere will appear darker  (transmit  less light) near the
  3010.                edges, where the glass is  thickest.   To account for this
  3011.                effect,  the  "DENSITY"   keyword   was  added.    Density
  3012.                specifies what  percentage  of  transmitted  light will be
  3013.                removed per unit  distance  travelled  though  the object.
  3014.                For example, the following density  attribute would remove
  3015.                2 percent of all light per unit distance:
  3016.                
  3017.                     DENSITY = (.02, .02, .02);
  3018.                
  3019.                If a sphere, at its widest  point,  was 10 units thick, 20
  3020.                percent of the light would  be  removed.  Near the edge of
  3021.                the sphere, less light would be removed.
  3022.                
  3023.                Since density is a function of  distance, the same density
  3024.                factor will have different effects on objects of different
  3025.                sizes.  To remove the  same  percentage  of  light from an
  3026.                object half as thick, double the density factor.
  3027.                
  3028.  
  3029.  
  3030.         QRT Ray Tracer               Page 1               Addendum to 1.4
  3031.  
  3032.  
  3033.  
  3034.  
  3035.  
  3036.  
  3037.  
  3038.  
  3039.  
  3040.  
  3041.  
  3042.  
  3043.            Shadows from Transparent Surfaces
  3044.                
  3045.                The old "TRANS" keyword  still  exists,  but it performs a
  3046.                different function.  It does not  affect the appearance of
  3047.                the object, but rather, the  attenuation  of  light passed
  3048.                through the surface.  QRT  knows  how  glass surfaces bend
  3049.                light, and so it  can  model  the  magnifying  effects  of
  3050.                looking through  curved  glass,  etc.   But  for computing
  3051.                shadows, it cannot  properly  bend  the  light from lamps.
  3052.                This means that you  can  model  lenses  that the observer
  3053.                looks through, but  not  lenses  used  to focus light.  In
  3054.                order to provide  some attenuation effects, use "TRANS" to
  3055.                tell QRT how much light  is  passed  through  the surface.
  3056.                This information is ONLY used  for computing shadows.  For
  3057.                example,  blue  glass  should  cast  a  blue  shadow.  Use
  3058.                something similar to:
  3059.                
  3060.                         TRANS = (0, 0, .7)
  3061.                
  3062.                to cast a blue shadow (this  lets  70  percent of the blue
  3063.                light pass).  Note that by  using  strange combinations of
  3064.                DENSITY and TRANS, you can  model  illogical objects which
  3065.                appear, for example, blue,  but  cast a red shadow.  These
  3066.                shadows will be entirely of  one  intensity,  and will not
  3067.                vary with the thickness of the glass.
  3068.                
  3069.            Using MIRROR with Transparent surfaces
  3070.                
  3071.                Glass surfaces not only refract  light, but also reflect a
  3072.                percentage of it.  This means  that to realistically model
  3073.                glass, the glass should reflect  a small percentage of the
  3074.                light.   Try starting with  20  to  25 percent reflection.
  3075.                Note that all glass objects  reflect  light  from both the
  3076.                outside and the inside surfaces of the glass.
  3077.                
  3078.            Index of Refraction
  3079.                
  3080.                The index of refraction for an object governs how much the
  3081.                light is bent  upon  entering  or  exiting  the object.  A
  3082.                higher index will  bend  the  light  more.   The  index of
  3083.                refraction of air is 1.00, and  for glass is roughly 1.33.
  3084.                Some substances, such as diamond, have a higher index.
  3085.                
  3086.            Modeling Hollow Objects
  3087.                
  3088.                When designing the QRT transmission  routines, I wanted to
  3089.                be able  to  model  both  solid  glass  and  hollow  glass
  3090.                objects.  To understand how this  is done, it is necessary
  3091.                to understand a little about how  QRT's transmission model
  3092.                works.
  3093.                
  3094.  
  3095.  
  3096.         QRT Ray Tracer               Page 2               Addendum to 1.4
  3097.  
  3098.  
  3099.  
  3100.  
  3101.  
  3102.  
  3103.  
  3104.  
  3105.  
  3106.  
  3107.  
  3108.  
  3109.                A ray, after leaving the observer,  has two states: either
  3110.                it is inside a glass  object,  or  it is outside.  The ray
  3111.                starts out outside.   When  it  first  encounters  a glass
  3112.                surface, it is bent, and its state is toggled from OUTSIDE
  3113.                to INSIDE.  It continues  on  until  encountering  another
  3114.                surface, whereupon it is bent again, and its state is once
  3115.                more toggled.  This has several  implications for modeling
  3116.                glass.  The first is that ALL glass surfaces MUST have two
  3117.                sides - that is, once the ray enters the glass, there must
  3118.                be no way for it to exit  without  again passing through a
  3119.                surface.  The second is that  a  ray must go from glass to
  3120.                air, or air to glass,  but  not  from  glass with index of
  3121.                refraction A to glass with index of refraction B; i.e, the
  3122.                two glass surfaces cannot  touch  each  other, even though
  3123.                they may be placed very close together.
  3124.                
  3125.                As an example of how this  works,  consider  a solid glass
  3126.                sphere.  The ray encounters  the  sphere,  and is bent (in
  3127.                this case, towards the normal  vector).  QRT now remembers
  3128.                that  the  ray  is  INSIDE  a  glass  surface.    The  ray
  3129.                continues on until it hits  the  back  side of the sphere,
  3130.                whereupon it is bent (away  from  the  normal vector), and
  3131.                its  state  is  toggled  to   OUTSIDE.   In  summary,  the
  3132.                INSIDE/OUTSIDE flag tells QRT how to bend the ray.
  3133.                
  3134.                Consider now the case of a  hollow  glass sphere.  This is
  3135.                modeled using two concentric  spheres,  one with a smaller
  3136.                radius.  The ray will  first  hit  the  outside sphere, be
  3137.                bent, and have its state toggled  to INSIDE. There are now
  3138.                two possible cases.  First,  the  ray  may miss the inside
  3139.                sphere, in which case the  simulation  proceeds  as in the
  3140.                above paragraph.  Second,  it  may  hit the inside sphere.
  3141.                In this case, it is  bent,  and  its  state  is toggled to
  3142.                OUTSIDE.  The ray is now considered  to be back in air, so
  3143.                that the inside sphere has  modeled  the hollow portion of
  3144.                the glass.  In a similar manner, the ray reaches the other
  3145.                side of the inside  sphere,  enters  the  glass again, and
  3146.                finally leaves the outside sphere.   Note that even though
  3147.                the inside sphere is thought of as the "air" in the center
  3148.                of the object, it MUST have  the  same index of refraction
  3149.                as the outside sphere.  This is  necessary so that QRT can
  3150.                correctly bend the light when it exits the glass.
  3151.                
  3152.            Chromatic Aberration
  3153.                
  3154.                In QRT,  all  rays,  regardless  of  color,  are refracted
  3155.                exactly the same.  This is contrast  to the real world, in
  3156.                which  the  amount  the  light  is  bent  depends  on  its
  3157.                wavelength.  This appears,  so  far as I can tell, to be a
  3158.                bug in the real world, and I  saw  no reason to include it
  3159.                in a ray tracer.
  3160.  
  3161.  
  3162.         QRT Ray Tracer               Page 3               Addendum to 1.4
  3163.  
  3164.  
  3165.  
  3166.  
  3167.  
  3168.  
  3169.  
  3170.  
  3171.  
  3172.  
  3173.  
  3174.  
  3175.                
  3176.            Threshold attribute
  3177.                
  3178.                A new keyword, THRESHOLD,  has  been  added to the default
  3179.                structure.   In  previous  versions  of  QRT,  there was a
  3180.                mechanism for detecting  infinite  recursion provided that
  3181.                objects  reflected  less  that  100  percent  of the light
  3182.                reaching  them.   QRT   stopped  the  recursion  when  the
  3183.                intensity of the light  reached  1 percent of its original
  3184.                value.  When  transmission  was  added,  I made this value
  3185.                adjustable.  With  glass  objects,  both  surfaces reflect
  3186.                light, and if QRT waits  until  the  1 percent mark before
  3187.                stopping recursion,  the  time  necessary  to complete the
  3188.                image is greatly increased  with  little or no increase in
  3189.                image quality.   The  default  is  now  10 percent, and is
  3190.                changeable as follows:
  3191.                
  3192.                     DEFAULT ( threshold = .05
  3193.                             )
  3194.                
  3195.                This would stop  recursion  when  the  intensity reaches 5
  3196.                percent of the original value.  An added effect is that if
  3197.                the objects surface reflects (or  transmits) less than the
  3198.                threshold amount of light, the  reflection or transmission
  3199.                will be ignored completely.
  3200.                
  3201.            Affect of Glass on Speed
  3202.                
  3203.                Unfortunately, the presence of any glass objects will slow
  3204.                the ray tracer down.  This  effect  may  range from barely
  3205.                noticeable,  for  few,  small  objects  to  excruciatingly
  3206.                miserably slow, for many, large  objects.  Sorry, there is
  3207.                nothing I can do to speed it  up  - the 68000 simply won't
  3208.                go any faster.  The reason for the 
  3209.                slowdown is that for every ray/glass surface intersection,
  3210.                TWO additional rays must be  sent  out (as opposed to one,
  3211.                for reflection).   And  remember,  each  ray  intersects a
  3212.                glass object twice: once on  the  way  in, and once on the
  3213.                way out.  Also, the two  generated  rays may intersect the
  3214.                glass, as well.  You can  see  how  this process could get
  3215.                very slow.
  3216.                
  3217.         Notes, etc.
  3218.            
  3219.            Watch for control  characters  in  the  QRT input file.  I had
  3220.            accidentally imbedded an invisible control character in a file
  3221.            I was working on, and  the  QRT  parser  refused  to parse the
  3222.            file.  After closely checking the  file, I began to look for a
  3223.            bug in the parser  code.   Finally,  I  discovered the control
  3224.            character, but only after spending  1 hour checking the parser
  3225.            code.  The QRT parser will  generate  a SYNTAX ERROR, CODE 207
  3226.  
  3227.  
  3228.         QRT Ray Tracer               Page 4               Addendum to 1.4
  3229.  
  3230.  
  3231.  
  3232.  
  3233.  
  3234.  
  3235.  
  3236.  
  3237.  
  3238.  
  3239.  
  3240.  
  3241.            upon encountering any special characters in the input file.
  3242.            
  3243.            Since transmission involves  heavy  recursion, don't forget to
  3244.            set the default  stack  size  to  something  larger  than  the
  3245.            default 4000 bytes.  A  stack  size  of  40000  to 50000 bytes
  3246.            seems safe for most images.
  3247.            
  3248.         Notes on Multitasking
  3249.            
  3250.            The following discussion is not at all QRT specific, but it is
  3251.            here just to clear up some  confusion  many  people have about
  3252.            multitasking. 
  3253.            
  3254.            There has been some discussion to the effect that multitasking
  3255.            is either: a) not  useful  at  all  (just  ask  Apple/Mac type
  3256.            folks), or b) useful only as a mechanism for loading more than
  3257.            one interactive program  at  once  and  switching between them
  3258.            (said/believed by many Amiga  folks).   While  for some people
  3259.            this may be true, for anyone who  runs ray tracers, mandelbrot
  3260.            set program, or down/uploads programs from a BBS, multitasking
  3261.            holds great benefits.  Try this:  run QRT on the Amiga, in the
  3262.            background, with a low task  priority.   Now  forget about it,
  3263.            and  do  whatever  else   you   wanted   to  do  (run  a  text
  3264.            editor/spreadsheet/terminal prog, etc).  Now, run a ray tracer
  3265.            on an IBM or MAC II, and  you'll  very quickly tire of staring
  3266.            at the machine while it thinks.  
  3267.            
  3268.            The key to getting the maximum benefit from multitasking, (and
  3269.            this is what many  people  don't  realize),  is  being able to
  3270.            specify task priorities.  Non  interactive,  number  crunching
  3271.            tasks should be given a low priority (try -5).  This will give
  3272.            any interactive tasks all the CPU time they want.  By lowering
  3273.            the  priority  of  the   background   tasks,   the  editor  or
  3274.            spreadsheet or compiler will run just as fast as it would have
  3275.            without the background task.   If  the  background task is run
  3276.            with the SAME priority as the  foreground  task (editor, etc),
  3277.            the foreground task will run  noticeably  slower.   Don't ever
  3278.            run a task such as a ray tracer  with a HIGHER priority as the
  3279.            CLI or interactive task.  Doing  so will cause the interactive
  3280.            task to stop dead until the ray tracer has finished.
  3281.            
  3282.            One more note on multitasking for programmers: do try to write
  3283.            nice, friendly programs that  give  up the CPU when they don't
  3284.            need it.  Number crunching programs typically need all the CPU
  3285.            time they can get; however,  interactive  programs do not.  If
  3286.            you wish to wait, use the timer  device, not a for loop.  This
  3287.            has two advantages: 1)  it  doesn't  hog  the  CPU, and 2) the
  3288.            elapsed time will be  relatively  independent  of how busy the
  3289.            CPU is.  There  is  nothing  more  annoying  than  some little
  3290.            calculator or notepad  program  that  wants  ALL the CPU time,
  3291.            causing low priority  tasks  to  stop.   Even  some commercial
  3292.  
  3293.  
  3294.         QRT Ray Tracer               Page 5               Addendum to 1.4
  3295.  
  3296.  
  3297.  
  3298.  
  3299.  
  3300.  
  3301.  
  3302.  
  3303.  
  3304.  
  3305.  
  3306.  
  3307.            software  houses  have  committed  this  fault  (witness  some
  3308.            popular paint programs or terminal programs).
  3309.            
  3310.            OK, enough preaching  about  multitasking.   I  hope  this has
  3311.            cleared up the issue for anyone who was confused.
  3312.  
  3313.  
  3314.  
  3315.  
  3316.  
  3317.  
  3318.  
  3319.  
  3320.  
  3321.  
  3322.  
  3323.  
  3324.  
  3325.  
  3326.  
  3327.  
  3328.  
  3329.  
  3330.  
  3331.  
  3332.  
  3333.  
  3334.  
  3335.  
  3336.  
  3337.  
  3338.  
  3339.  
  3340.  
  3341.  
  3342.  
  3343.  
  3344.  
  3345.  
  3346.  
  3347.  
  3348.  
  3349.  
  3350.  
  3351.  
  3352.  
  3353.  
  3354.  
  3355.  
  3356.  
  3357.  
  3358.  
  3359.  
  3360.         QRT Ray Tracer               Page 6               Addendum to 1.4
  3361.  
  3362.  
  3363.  
  3364.  
  3365.  
  3366.